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
fa3961d4
Commit
fa3961d4
authored
Mar 05, 2013
by
Arthur Barrett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merged openended and advanced categories per discussion at today's standup
parent
ef9f963f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
cms/djangoapps/contentstore/views.py
+15
-14
No files found.
cms/djangoapps/contentstore/views.py
View file @
fa3961d4
...
@@ -70,8 +70,7 @@ log = logging.getLogger(__name__)
...
@@ -70,8 +70,7 @@ log = logging.getLogger(__name__)
COMPONENT_TYPES
=
[
'customtag'
,
'discussion'
,
'html'
,
'problem'
,
'video'
]
COMPONENT_TYPES
=
[
'customtag'
,
'discussion'
,
'html'
,
'problem'
,
'video'
]
ADVANCED_COMPONENT_TYPES
=
{
ADVANCED_COMPONENT_TYPES
=
{
'openended'
:
[
'combinedopenended'
,
'peergrading'
],
'advanced'
:
[
'annotatable'
,
'combinedopenended'
,
'peergrading'
]
'advanced'
:
[
'annotatable'
],
}
}
ADVANCED_COMPONENT_POLICY_KEY
=
'advanced_modules'
ADVANCED_COMPONENT_POLICY_KEY
=
'advanced_modules'
...
@@ -293,18 +292,20 @@ def edit_unit(request, location):
...
@@ -293,18 +292,20 @@ def edit_unit(request, location):
course_metadata
=
CourseMetadata
.
fetch
(
course
.
location
)
course_metadata
=
CourseMetadata
.
fetch
(
course
.
location
)
course_advanced_keys
=
course_metadata
.
get
(
ADVANCED_COMPONENT_POLICY_KEY
,
[])
course_advanced_keys
=
course_metadata
.
get
(
ADVANCED_COMPONENT_POLICY_KEY
,
[])
#First try to parse with json
# check if the keys are in JSON format, or perhaps a literal python expression
try
:
if
isinstance
(
course_advanced_keys
,
basestring
):
course_advanced_keys
=
json
.
loads
(
course_advanced_keys
)
# Are you JSON?
except
:
try
:
log
.
error
(
"Cannot json decode course advanced policy: {0}"
.
format
(
course_advanced_keys
))
course_advanced_keys
=
json
.
loads
(
course_advanced_keys
)
#It may be that it is not a json object, but can be evaluated as a python literal
except
:
try
:
log
.
error
(
"Cannot JSON decode course advanced policy: {0}"
.
format
(
course_advanced_keys
))
#This is a safe evaluation. See docs for ast
# Not JSON? How about Python?
course_advanced_keys
=
ast
.
literal_eval
(
course_advanced_keys
)
try
:
except
:
#This is a safe evaluation. See docs for ast
log
.
error
(
"Cannot parse course advanced policy at all: {0}"
.
format
(
course_advanced_keys
))
course_advanced_keys
=
ast
.
literal_eval
(
course_advanced_keys
)
course_advanced_keys
=
[]
except
:
log
.
error
(
"Cannot parse course advanced policy at all: {0}"
.
format
(
course_advanced_keys
))
course_advanced_keys
=
[]
#Set component types according to course policy file
#Set component types according to course policy file
component_types
=
COMPONENT_TYPES
component_types
=
COMPONENT_TYPES
...
...
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