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
ef042c39
Commit
ef042c39
authored
Sep 03, 2013
by
Adam
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #853 from edx/fix/adam/pylint-pep8
fix pep8 and pylint errors
parents
3cc793b0
300f7f13
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
29 deletions
+42
-29
cms/djangoapps/contentstore/management/commands/check_course.py
+0
-1
cms/djangoapps/contentstore/views/course.py
+12
-5
common/lib/capa/capa/inputtypes.py
+18
-15
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
+8
-6
lms/envs/common.py
+4
-2
No files found.
cms/djangoapps/contentstore/management/commands/check_course.py
View file @
ef042c39
...
@@ -60,4 +60,3 @@ class Command(BaseCommand):
...
@@ -60,4 +60,3 @@ class Command(BaseCommand):
for
item
in
queried_discussion_items
:
for
item
in
queried_discussion_items
:
if
item
.
location
.
url
()
not
in
discussion_items
:
if
item
.
location
.
url
()
not
in
discussion_items
:
print
'Found dangling discussion module = {0}'
.
format
(
item
.
location
.
url
())
print
'Found dangling discussion module = {0}'
.
format
(
item
.
location
.
url
())
cms/djangoapps/contentstore/views/course.py
View file @
ef042c39
...
@@ -134,8 +134,12 @@ def create_new_course(request):
...
@@ -134,8 +134,12 @@ def create_new_course(request):
'course number so that it is unique.'
),
'course number so that it is unique.'
),
})
})
course_search_location
=
[
'i4x'
,
dest_location
.
org
,
dest_location
.
course
,
course_search_location
=
[
'course'
,
None
'i4x'
,
dest_location
.
org
,
dest_location
.
course
,
'course'
,
None
]
]
courses
=
modulestore
()
.
get_items
(
course_search_location
)
courses
=
modulestore
()
.
get_items
(
course_search_location
)
if
len
(
courses
)
>
0
:
if
len
(
courses
)
>
0
:
...
@@ -203,13 +207,16 @@ def course_info(request, org, course, name, provided_id=None):
...
@@ -203,13 +207,16 @@ def course_info(request, org, course, name, provided_id=None):
# get current updates
# get current updates
location
=
Location
([
'i4x'
,
org
,
course
,
'course_info'
,
"updates"
])
location
=
Location
([
'i4x'
,
org
,
course
,
'course_info'
,
"updates"
])
return
render_to_response
(
'course_info.html'
,
{
return
render_to_response
(
'course_info.html'
,
{
'context_course'
:
course_module
,
'context_course'
:
course_module
,
'url_base'
:
"/"
+
org
+
"/"
+
course
+
"/"
,
'url_base'
:
"/"
+
org
+
"/"
+
course
+
"/"
,
'course_updates'
:
json
.
dumps
(
get_course_updates
(
location
)),
'course_updates'
:
json
.
dumps
(
get_course_updates
(
location
)),
'handouts_location'
:
Location
([
'i4x'
,
org
,
course
,
'course_info'
,
'handouts'
])
.
url
(),
'handouts_location'
:
Location
([
'i4x'
,
org
,
course
,
'course_info'
,
'handouts'
])
.
url
(),
'base_asset_url'
:
StaticContent
.
get_base_url_path_for_course_assets
(
location
)
+
'/'
})
'base_asset_url'
:
StaticContent
.
get_base_url_path_for_course_assets
(
location
)
+
'/'
}
)
@expect_json
@expect_json
@require_http_methods
((
"GET"
,
"POST"
,
"PUT"
,
"DELETE"
))
@require_http_methods
((
"GET"
,
"POST"
,
"PUT"
,
"DELETE"
))
...
...
common/lib/capa/capa/inputtypes.py
View file @
ef042c39
...
@@ -208,10 +208,10 @@ class InputTypeBase(object):
...
@@ -208,10 +208,10 @@ class InputTypeBase(object):
# end up in a partially-initialized state.
# end up in a partially-initialized state.
loaded
=
{}
loaded
=
{}
to_render
=
set
()
to_render
=
set
()
for
a
in
self
.
get_attributes
():
for
a
ttribute
in
self
.
get_attributes
():
loaded
[
a
.
name
]
=
a
.
parse_from_xml
(
self
.
xml
)
loaded
[
a
ttribute
.
name
]
=
attribute
.
parse_from_xml
(
self
.
xml
)
if
a
.
render
:
if
a
ttribute
.
render
:
to_render
.
add
(
a
.
name
)
to_render
.
add
(
a
ttribute
.
name
)
self
.
loaded_attributes
=
loaded
self
.
loaded_attributes
=
loaded
self
.
to_render
=
to_render
self
.
to_render
=
to_render
...
@@ -493,7 +493,8 @@ class JSInput(InputTypeBase):
...
@@ -493,7 +493,8 @@ class JSInput(InputTypeBase):
"""
"""
Register the attributes.
Register the attributes.
"""
"""
return
[
Attribute
(
'params'
,
None
),
# extra iframe params
return
[
Attribute
(
'params'
,
None
),
# extra iframe params
Attribute
(
'html_file'
,
None
),
Attribute
(
'html_file'
,
None
),
Attribute
(
'gradefn'
,
"gradefn"
),
Attribute
(
'gradefn'
,
"gradefn"
),
Attribute
(
'get_statefn'
,
None
),
# Function to call in iframe
Attribute
(
'get_statefn'
,
None
),
# Function to call in iframe
...
@@ -501,9 +502,8 @@ class JSInput(InputTypeBase):
...
@@ -501,9 +502,8 @@ class JSInput(InputTypeBase):
Attribute
(
'set_statefn'
,
None
),
# Function to call iframe to
Attribute
(
'set_statefn'
,
None
),
# Function to call iframe to
# set state
# set state
Attribute
(
'width'
,
"400"
),
# iframe width
Attribute
(
'width'
,
"400"
),
# iframe width
Attribute
(
'height'
,
"300"
)]
# iframe height
Attribute
(
'height'
,
"300"
)
# iframe height
]
def
_extra_context
(
self
):
def
_extra_context
(
self
):
context
=
{
context
=
{
...
@@ -514,7 +514,6 @@ class JSInput(InputTypeBase):
...
@@ -514,7 +514,6 @@ class JSInput(InputTypeBase):
return
context
return
context
registry
.
register
(
JSInput
)
registry
.
register
(
JSInput
)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
...
@@ -1048,8 +1047,8 @@ class ChemicalEquationInput(InputTypeBase):
...
@@ -1048,8 +1047,8 @@ class ChemicalEquationInput(InputTypeBase):
try
:
try
:
result
[
'preview'
]
=
chemcalc
.
render_to_html
(
formula
)
result
[
'preview'
]
=
chemcalc
.
render_to_html
(
formula
)
except
pyparsing
.
ParseException
as
p
:
except
pyparsing
.
ParseException
as
err
:
result
[
'error'
]
=
u"Couldn't parse formula: {0}"
.
format
(
p
.
msg
)
result
[
'error'
]
=
u"Couldn't parse formula: {0}"
.
format
(
err
.
msg
)
except
Exception
:
except
Exception
:
# this is unexpected, so log
# this is unexpected, so log
log
.
warning
(
log
.
warning
(
...
@@ -1189,15 +1188,19 @@ class DragAndDropInput(InputTypeBase):
...
@@ -1189,15 +1188,19 @@ class DragAndDropInput(InputTypeBase):
'can_reuse': smth}.
'can_reuse': smth}.
"""
"""
tag_attrs
=
dict
()
tag_attrs
=
dict
()
tag_attrs
[
'draggable'
]
=
{
'id'
:
Attribute
.
_sentinel
,
tag_attrs
[
'draggable'
]
=
{
'id'
:
Attribute
.
_sentinel
,
'label'
:
""
,
'icon'
:
""
,
'label'
:
""
,
'icon'
:
""
,
'can_reuse'
:
""
}
'can_reuse'
:
""
}
tag_attrs
[
'target'
]
=
{
'id'
:
Attribute
.
_sentinel
,
tag_attrs
[
'target'
]
=
{
'id'
:
Attribute
.
_sentinel
,
'x'
:
Attribute
.
_sentinel
,
'x'
:
Attribute
.
_sentinel
,
'y'
:
Attribute
.
_sentinel
,
'y'
:
Attribute
.
_sentinel
,
'w'
:
Attribute
.
_sentinel
,
'w'
:
Attribute
.
_sentinel
,
'h'
:
Attribute
.
_sentinel
}
'h'
:
Attribute
.
_sentinel
}
dic
=
dict
()
dic
=
dict
()
...
...
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
View file @
ef042c39
...
@@ -23,9 +23,11 @@ from xmodule.combined_open_ended_module import CombinedOpenEndedModule
...
@@ -23,9 +23,11 @@ from xmodule.combined_open_ended_module import CombinedOpenEndedModule
from
xmodule.modulestore
import
Location
from
xmodule.modulestore
import
Location
from
xmodule.tests
import
get_test_system
,
test_util_open_ended
from
xmodule.tests
import
get_test_system
,
test_util_open_ended
from
xmodule.progress
import
Progress
from
xmodule.progress
import
Progress
from
xmodule.tests.test_util_open_ended
import
(
MockQueryDict
,
DummyModulestore
,
TEST_STATE_SA_IN
,
from
xmodule.tests.test_util_open_ended
import
(
MockQueryDict
,
DummyModulestore
,
TEST_STATE_SA_IN
,
MOCK_INSTANCE_STATE
,
TEST_STATE_SA
,
TEST_STATE_AI
,
TEST_STATE_AI2
,
TEST_STATE_AI2_INVALID
,
MOCK_INSTANCE_STATE
,
TEST_STATE_SA
,
TEST_STATE_AI
,
TEST_STATE_AI2
,
TEST_STATE_AI2_INVALID
,
TEST_STATE_SINGLE
,
TEST_STATE_PE_SINGLE
)
TEST_STATE_SINGLE
,
TEST_STATE_PE_SINGLE
)
import
capa.xqueue_interface
as
xqueue_interface
import
capa.xqueue_interface
as
xqueue_interface
...
@@ -553,7 +555,7 @@ class CombinedOpenEndedModuleTest(unittest.TestCase):
...
@@ -553,7 +555,7 @@ class CombinedOpenEndedModuleTest(unittest.TestCase):
descriptor
,
descriptor
,
static_data
=
self
.
static_data
,
static_data
=
self
.
static_data
,
metadata
=
self
.
metadata
,
metadata
=
self
.
metadata
,
instance_state
=
{
'task_states'
:
TEST_STATE_SA
})
instance_state
=
{
'task_states'
:
TEST_STATE_SA
})
combinedoe
=
CombinedOpenEndedV1Module
(
self
.
test_system
,
combinedoe
=
CombinedOpenEndedV1Module
(
self
.
test_system
,
self
.
location
,
self
.
location
,
...
@@ -561,7 +563,7 @@ class CombinedOpenEndedModuleTest(unittest.TestCase):
...
@@ -561,7 +563,7 @@ class CombinedOpenEndedModuleTest(unittest.TestCase):
descriptor
,
descriptor
,
static_data
=
self
.
static_data
,
static_data
=
self
.
static_data
,
metadata
=
self
.
metadata
,
metadata
=
self
.
metadata
,
instance_state
=
{
'task_states'
:
TEST_STATE_SA_IN
})
instance_state
=
{
'task_states'
:
TEST_STATE_SA_IN
})
def
test_get_score_realistic
(
self
):
def
test_get_score_realistic
(
self
):
...
@@ -605,7 +607,7 @@ class CombinedOpenEndedModuleTest(unittest.TestCase):
...
@@ -605,7 +607,7 @@ class CombinedOpenEndedModuleTest(unittest.TestCase):
descriptor
=
Mock
(
data
=
definition
)
descriptor
=
Mock
(
data
=
definition
)
instance_state
=
{
'task_states'
:
task_state
,
'graded'
:
True
}
instance_state
=
{
'task_states'
:
task_state
,
'graded'
:
True
}
if
task_number
is
not
None
:
if
task_number
is
not
None
:
instance_state
.
update
({
'current_task_number'
:
task_number
})
instance_state
.
update
({
'current_task_number'
:
task_number
})
combinedoe
=
CombinedOpenEndedV1Module
(
self
.
test_system
,
combinedoe
=
CombinedOpenEndedV1Module
(
self
.
test_system
,
self
.
location
,
self
.
location
,
definition
,
definition
,
...
@@ -711,7 +713,7 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
...
@@ -711,7 +713,7 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
#Simulate a student saving an answer
#Simulate a student saving an answer
html
=
module
.
handle_ajax
(
"get_html"
,
{})
html
=
module
.
handle_ajax
(
"get_html"
,
{})
module
.
handle_ajax
(
"save_answer"
,
{
"student_answer"
:
self
.
answer
,
"can_upload_files"
:
False
,
"student_file"
:
None
})
module
.
handle_ajax
(
"save_answer"
,
{
"student_answer"
:
self
.
answer
,
"can_upload_files"
:
False
,
"student_file"
:
None
})
html
=
module
.
handle_ajax
(
"get_html"
,
{})
html
=
module
.
handle_ajax
(
"get_html"
,
{})
#Mock a student submitting an assessment
#Mock a student submitting an assessment
...
...
lms/envs/common.py
View file @
ef042c39
...
@@ -290,12 +290,14 @@ WIKI_ENABLED = False
...
@@ -290,12 +290,14 @@ WIKI_ENABLED = False
###
###
COURSE_DEFAULT
=
'6.002x_Fall_2012'
COURSE_DEFAULT
=
'6.002x_Fall_2012'
COURSE_SETTINGS
=
{
'6.002x_Fall_2012'
:
{
'number'
:
'6.002x'
,
COURSE_SETTINGS
=
{
'6.002x_Fall_2012'
:
{
'number'
:
'6.002x'
,
'title'
:
'Circuits and Electronics'
,
'title'
:
'Circuits and Electronics'
,
'xmlpath'
:
'6002x/'
,
'xmlpath'
:
'6002x/'
,
'location'
:
'i4x://edx/6002xs12/course/6.002x_Fall_2012'
,
'location'
:
'i4x://edx/6002xs12/course/6.002x_Fall_2012'
,
}
}
}
}
# IP addresses that are allowed to reload the course, etc.
# IP addresses that are allowed to reload the course, etc.
# TODO (vshnayder): Will probably need to change as we get real access control in.
# TODO (vshnayder): Will probably need to change as we get real access control in.
...
...
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