Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
b574dcb8
Commit
b574dcb8
authored
Jun 01, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for None with is rather than ==
parent
71e25d9b
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
20 additions
and
20 deletions
+20
-20
djangoapps/courseware/capa/capa_problem.py
+1
-1
djangoapps/courseware/capa/inputtypes.py
+1
-1
djangoapps/courseware/capa/responsetypes.py
+6
-6
djangoapps/courseware/content_parser.py
+1
-1
djangoapps/courseware/grades.py
+1
-1
djangoapps/courseware/module_render.py
+1
-1
djangoapps/courseware/modules/capa_module.py
+2
-2
djangoapps/courseware/modules/seq_module.py
+2
-2
djangoapps/courseware/modules/video_module.py
+1
-1
djangoapps/courseware/views.py
+2
-2
djangoapps/simplewiki/views.py
+1
-1
templates/video.html
+1
-1
No files found.
djangoapps/courseware/capa/capa_problem.py
View file @
b574dcb8
...
...
@@ -91,7 +91,7 @@ class LoncapaProblem(object):
self
.
problem_id
=
id
self
.
system
=
system
if
seed
!=
None
:
if
seed
is
not
None
:
self
.
seed
=
seed
if
state
:
...
...
djangoapps/courseware/capa/inputtypes.py
View file @
b574dcb8
...
...
@@ -133,7 +133,7 @@ class SimpleInput():# XModule
def
register_render_function
(
fn
,
names
=
None
,
cls
=
SimpleInput
):
if
names
==
None
:
if
names
is
None
:
SimpleInput
.
xml_tags
[
fn
.
__name__
]
=
fn
else
:
raise
NotImplementedError
...
...
djangoapps/courseware/capa/responsetypes.py
View file @
b574dcb8
...
...
@@ -109,7 +109,7 @@ class MultipleChoiceResponse(GenericResponse):
if
rtype
not
in
[
"MultipleChoice"
]:
response
.
set
(
"type"
,
"MultipleChoice"
)
# force choicegroup to be MultipleChoice if not valid
for
choice
in
list
(
response
):
if
choice
.
get
(
"name"
)
==
None
:
if
choice
.
get
(
"name"
)
is
None
:
choice
.
set
(
"name"
,
"choice_"
+
str
(
i
))
i
+=
1
else
:
...
...
@@ -121,7 +121,7 @@ class TrueFalseResponse(MultipleChoiceResponse):
for
response
in
self
.
xml
.
xpath
(
"choicegroup"
):
response
.
set
(
"type"
,
"TrueFalse"
)
for
choice
in
list
(
response
):
if
choice
.
get
(
"name"
)
==
None
:
if
choice
.
get
(
"name"
)
is
None
:
choice
.
set
(
"name"
,
"choice_"
+
str
(
i
))
i
+=
1
else
:
...
...
@@ -292,7 +292,7 @@ def sympy_check2():
self
.
code
=
''
else
:
answer_src
=
answer
.
get
(
'src'
)
if
answer_src
!=
None
:
if
answer_src
is
not
None
:
self
.
code
=
open
(
settings
.
DATA_DIR
+
'src/'
+
answer_src
)
.
read
()
else
:
self
.
code
=
answer
.
text
...
...
@@ -418,7 +418,7 @@ class ExternalResponse(GenericResponse):
id
=
xml
.
get
(
'id'
))[
0
]
answer_src
=
answer
.
get
(
'src'
)
if
answer_src
!=
None
:
if
answer_src
is
not
None
:
self
.
code
=
open
(
settings
.
DATA_DIR
+
'src/'
+
answer_src
)
.
read
()
else
:
self
.
code
=
answer
.
text
...
...
@@ -489,7 +489,7 @@ class FormulaResponse(GenericResponse):
self
.
context
=
context
ts
=
xml
.
get
(
'type'
)
if
ts
==
None
:
if
ts
is
None
:
typeslist
=
[]
else
:
typeslist
=
ts
.
split
(
','
)
...
...
@@ -558,7 +558,7 @@ class SchematicResponse(GenericResponse):
answer
=
xml
.
xpath
(
'//*[@id=$id]//answer'
,
id
=
xml
.
get
(
'id'
))[
0
]
answer_src
=
answer
.
get
(
'src'
)
if
answer_src
!=
None
:
if
answer_src
is
not
None
:
self
.
code
=
self
.
system
.
filestore
.
open
(
'src/'
+
answer_src
)
.
read
()
# Untested; never used
else
:
self
.
code
=
answer
.
text
...
...
djangoapps/courseware/content_parser.py
View file @
b574dcb8
...
...
@@ -126,7 +126,7 @@ def propogate_downward_tag(element, attribute_name, parent_attribute = None):
child (A) already has that attribute, A will keep the same attribute and
all of A's children will inherit A's attribute. This is a recursive call.'''
if
(
parent_attribute
==
None
):
#This is the entry call. Select all elements with this attribute
if
(
parent_attribute
is
None
):
#This is the entry call. Select all elements with this attribute
all_attributed_elements
=
element
.
xpath
(
"//*[@"
+
attribute_name
+
"]"
)
for
attributed_element
in
all_attributed_elements
:
attribute_value
=
attributed_element
.
get
(
attribute_name
)
...
...
djangoapps/courseware/grades.py
View file @
b574dcb8
...
...
@@ -190,7 +190,7 @@ def get_score(user, problem, cache, coursename=None):
correct
=
float
(
response
.
grade
)
# Grab max grade from cache, or if it doesn't exist, compute and save to DB
if
id
in
cache
and
response
.
max_grade
!=
None
:
if
id
in
cache
and
response
.
max_grade
is
not
None
:
total
=
response
.
max_grade
else
:
## HACK 1: We shouldn't specifically reference capa_module
...
...
djangoapps/courseware/module_render.py
View file @
b574dcb8
...
...
@@ -75,7 +75,7 @@ def grade_histogram(module_id):
grades
=
list
(
cursor
.
fetchall
())
grades
.
sort
(
key
=
lambda
x
:
x
[
0
])
# Probably not necessary
if
(
len
(
grades
)
==
1
and
grades
[
0
][
0
]
==
None
):
if
(
len
(
grades
)
==
1
and
grades
[
0
][
0
]
is
None
):
return
[]
return
grades
...
...
djangoapps/courseware/modules/capa_module.py
View file @
b574dcb8
...
...
@@ -97,7 +97,7 @@ class Module(XModule):
reset_button
=
False
# We don't need a "save" button if infinite number of attempts and non-randomized
if
self
.
max_attempts
==
None
and
self
.
rerandomize
!=
"always"
:
if
self
.
max_attempts
is
None
and
self
.
rerandomize
!=
"always"
:
save_button
=
False
# Check if explanation is available, and if so, give a link
...
...
@@ -222,7 +222,7 @@ class Module(XModule):
''' Is the student still allowed to submit answers? '''
if
self
.
attempts
==
self
.
max_attempts
:
return
True
if
self
.
close_date
!=
None
and
datetime
.
datetime
.
utcnow
()
>
self
.
close_date
:
if
self
.
close_date
is
not
None
and
datetime
.
datetime
.
utcnow
()
>
self
.
close_date
:
return
True
return
False
...
...
djangoapps/courseware/modules/seq_module.py
View file @
b574dcb8
...
...
@@ -51,7 +51,7 @@ class Module(XModule):
## Returns a set of all types of all sub-children
child_classes
=
[
set
([
i
.
tag
for
i
in
e
.
iter
()])
for
e
in
self
.
xmltree
]
titles
=
[
"
\n
"
.
join
([
i
.
get
(
"name"
)
.
strip
()
for
i
in
e
.
iter
()
if
i
.
get
(
"name"
)
!=
None
])
\
titles
=
[
"
\n
"
.
join
([
i
.
get
(
"name"
)
.
strip
()
for
i
in
e
.
iter
()
if
i
.
get
(
"name"
)
is
not
None
])
\
for
e
in
self
.
xmltree
]
self
.
contents
=
[
j
(
self
.
render_function
(
e
))
for
e
in
self
.
xmltree
]
...
...
@@ -91,7 +91,7 @@ class Module(XModule):
self
.
position
=
1
if
state
!=
None
:
if
state
is
not
None
:
state
=
json
.
loads
(
state
)
if
'position'
in
state
:
self
.
position
=
int
(
state
[
'position'
])
...
...
djangoapps/courseware/modules/video_module.py
View file @
b574dcb8
...
...
@@ -47,7 +47,7 @@ class Module(XModule):
self
.
youtube
=
xmltree
.
get
(
'youtube'
)
self
.
name
=
xmltree
.
get
(
'name'
)
self
.
position
=
0
if
state
!=
None
:
if
state
is
not
None
:
state
=
json
.
loads
(
state
)
if
'position'
in
state
:
self
.
position
=
int
(
float
(
state
[
'position'
]))
...
...
djangoapps/courseware/views.py
View file @
b574dcb8
...
...
@@ -57,7 +57,7 @@ def profile(request, student_id = None):
''' User profile. Show username, location, etc, as well as grades .
We need to allow the user to change some of these settings .'''
if
student_id
==
None
:
if
student_id
is
None
:
student
=
request
.
user
else
:
if
'course_admin'
not
in
content_parser
.
user_groups
(
request
.
user
):
...
...
@@ -194,7 +194,7 @@ def index(request, course=None, chapter="Using the System", section="Hints"):
else
:
module_wrapper
=
dom_module
[
0
]
if
module_wrapper
==
None
:
if
module_wrapper
is
None
:
module
=
None
elif
module_wrapper
.
get
(
"src"
):
module
=
content_parser
.
section_file
(
user
=
user
,
section
=
module_wrapper
.
get
(
"src"
),
coursename
=
course
)
...
...
djangoapps/simplewiki/views.py
View file @
b574dcb8
...
...
@@ -482,7 +482,7 @@ def check_permissions(request, article, check_read=False, check_write=False, che
locked_err
=
check_locked
and
article
.
locked
if
revision
==
None
:
if
revision
is
None
:
revision
=
article
.
current_revision
deleted_err
=
check_deleted
and
not
(
revision
.
deleted
==
0
)
if
(
request
.
user
.
is_superuser
):
...
...
templates/video.html
View file @
b574dcb8
% if name is not UNDEFINED and name
!=
None:
% if name is not UNDEFINED and name
is not
None:
<h1>
${name}
</h1>
% endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment