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
e03585d8
Commit
e03585d8
authored
May 13, 2013
by
Steve Strassmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pylint: refactor imports
parent
b288a8e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
27 deletions
+48
-27
cms/djangoapps/contentstore/views/__init__.py
+19
-11
cms/djangoapps/contentstore/views/course.py
+29
-16
No files found.
cms/djangoapps/contentstore/views/__init__.py
View file @
e03585d8
from
assets
import
*
from
checklist
import
*
from
component
import
*
from
course
import
*
from
error
import
*
from
item
import
*
from
preview
import
*
from
public
import
*
from
user
import
*
from
tabs
import
*
from
requests
import
*
# pylint: disable=W0401, W0511
# TODO: component.py should explicitly enumerate exports with __all__
from
.component
import
*
# TODO: course.py should explicitly enumerate exports with __all__
from
.course
import
*
# Disable warnings about import from wildcard
# All files below declare exports with __all__
from
.assets
import
*
from
.checklist
import
*
from
.error
import
*
from
.item
import
*
from
.preview
import
*
from
.public
import
*
from
.user
import
*
from
.tabs
import
*
from
.requests
import
*
cms/djangoapps/contentstore/views/course.py
View file @
e03585d8
...
...
@@ -10,12 +10,16 @@ from django.core.urlresolvers import reverse
from
mitxmako.shortcuts
import
render_to_response
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
,
InvalidLocationError
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
,
\
InvalidLocationError
from
xmodule.modulestore
import
Location
from
contentstore.course_info_model
import
get_course_updates
,
update_course_updates
,
delete_course_update
from
contentstore.utils
import
get_lms_link_for_item
,
add_open_ended_panel_tab
,
remove_open_ended_panel_tab
from
models.settings.course_details
import
CourseDetails
,
CourseSettingsEncoder
from
contentstore.course_info_model
import
get_course_updates
,
\
update_course_updates
,
delete_course_update
from
contentstore.utils
import
get_lms_link_for_item
,
\
add_open_ended_panel_tab
,
remove_open_ended_panel_tab
from
models.settings.course_details
import
CourseDetails
,
\
CourseSettingsEncoder
from
models.settings.course_grading
import
CourseGradingModel
from
models.settings.course_metadata
import
CourseMetadata
from
auth.authz
import
create_all_course_groups
...
...
@@ -24,7 +28,8 @@ from util.json_request import expect_json
from
access
import
has_access
,
get_location_and_verify_access
from
requests
import
get_request_method
from
tabs
import
initialize_course_tabs
from
component
import
OPEN_ENDED_COMPONENT_TYPES
,
ADVANCED_COMPONENT_POLICY_KEY
from
component
import
OPEN_ENDED_COMPONENT_TYPES
,
\
ADVANCED_COMPONENT_POLICY_KEY
# TODO: should explicitly enumerate exports with __all__
...
...
@@ -325,18 +330,23 @@ def course_advanced_updates(request, org, course, name):
real_method
=
get_request_method
(
request
)
if
real_method
==
'GET'
:
return
HttpResponse
(
json
.
dumps
(
CourseMetadata
.
fetch
(
location
)),
mimetype
=
"application/json"
)
return
HttpResponse
(
json
.
dumps
(
CourseMetadata
.
fetch
(
location
)),
mimetype
=
"application/json"
)
elif
real_method
==
'DELETE'
:
return
HttpResponse
(
json
.
dumps
(
CourseMetadata
.
delete_key
(
location
,
json
.
loads
(
request
.
body
))),
return
HttpResponse
(
json
.
dumps
(
CourseMetadata
.
delete_key
(
location
,
json
.
loads
(
request
.
body
))),
mimetype
=
"application/json"
)
elif
real_method
==
'POST'
or
real_method
==
'PUT'
:
# NOTE: request.POST is messed up because expect_json cloned_request.POST.copy() is creating a defective entry w/ the whole payload as the key
# NOTE: request.POST is messed up because expect_json
# cloned_request.POST.copy() is creating a defective entry w/ the whole payload as the key
request_body
=
json
.
loads
(
request
.
body
)
#Whether or not to filter the tabs key out of the settings metadata
#
Whether or not to filter the tabs key out of the settings metadata
filter_tabs
=
True
#Check to see if the user instantiated any advanced components. This is a hack to add the open ended panel tab
#to a course automatically if the user has indicated that they want to edit the combinedopenended or peergrading
#module, and to remove it if they have removed the open ended elements.
# Check to see if the user instantiated any advanced components.
# This is a hack to add the open ended panel tab
# to a course automatically if the user has indicated that they want
# to edit the combinedopenended or peergrading
# module, and to remove it if they have removed the open ended elements.
if
ADVANCED_COMPONENT_POLICY_KEY
in
request_body
:
#Check to see if the user instantiated any open ended components
found_oe_type
=
False
...
...
@@ -346,7 +356,8 @@ def course_advanced_updates(request, org, course, name):
if
oe_type
in
request_body
[
ADVANCED_COMPONENT_POLICY_KEY
]:
#Add an open ended tab to the course if needed
changed
,
new_tabs
=
add_open_ended_panel_tab
(
course_module
)
#If a tab has been added to the course, then send the metadata along to CourseMetadata.update_from_json
# If a tab has been added to the course, then send the
# metadata along to CourseMetadata.update_from_json
if
changed
:
request_body
.
update
({
'tabs'
:
new_tabs
})
#Indicate that tabs should not be filtered out of the metadata
...
...
@@ -357,11 +368,13 @@ def course_advanced_updates(request, org, course, name):
#If we did not find an open ended module type in the advanced settings,
# we may need to remove the open ended tab from the course.
if
not
found_oe_type
:
#Remove open ended tab to the course if needed
#
Remove open ended tab to the course if needed
changed
,
new_tabs
=
remove_open_ended_panel_tab
(
course_module
)
if
changed
:
request_body
.
update
({
'tabs'
:
new_tabs
})
#Indicate that tabs should not be filtered out of the metadata
#
Indicate that tabs should not be filtered out of the metadata
filter_tabs
=
False
response_json
=
json
.
dumps
(
CourseMetadata
.
update_from_json
(
location
,
request_body
,
filter_tabs
=
filter_tabs
))
response_json
=
json
.
dumps
(
CourseMetadata
.
update_from_json
(
location
,
request_body
,
filter_tabs
=
filter_tabs
))
return
HttpResponse
(
response_json
,
mimetype
=
"application/json"
)
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