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
ce29b5ae
Commit
ce29b5ae
authored
Aug 15, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Special case handling of course url_names in policy.json
parent
a4d67bab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
common/lib/xmodule/xmodule/modulestore/xml.py
+8
-2
common/lib/xmodule/xmodule/x_module.py
+4
-0
No files found.
common/lib/xmodule/xmodule/modulestore/xml.py
View file @
ce29b5ae
...
@@ -234,10 +234,16 @@ class XMLModuleStore(ModuleStoreBase):
...
@@ -234,10 +234,16 @@ class XMLModuleStore(ModuleStoreBase):
system
=
ImportSystem
(
self
,
org
,
course
,
course_dir
,
tracker
)
system
=
ImportSystem
(
self
,
org
,
course
,
course_dir
,
tracker
)
course_descriptor
=
system
.
process_xml
(
etree
.
tostring
(
course_data
))
policy_path
=
self
.
data_dir
/
course_dir
/
'policy.json'
policy_path
=
self
.
data_dir
/
course_dir
/
'policy.json'
policy
=
self
.
load_policy
(
policy_path
,
tracker
)
policy
=
self
.
load_policy
(
policy_path
,
tracker
)
# Special case -- need to change the url_name of the course before
# it gets loaded, so its location and other fields are right
if
'course_url_name'
in
policy
:
new_url_name
=
policy
[
'course_url_name'
]
log
.
info
(
"changing course url_name to {}"
.
format
(
new_url_name
))
course_data
.
set
(
'url_name'
,
new_url_name
)
course_descriptor
=
system
.
process_xml
(
etree
.
tostring
(
course_data
))
XModuleDescriptor
.
apply_policy
(
course_descriptor
,
policy
)
XModuleDescriptor
.
apply_policy
(
course_descriptor
,
policy
)
# NOTE: The descriptors end up loading somewhat bottom up, which
# NOTE: The descriptors end up loading somewhat bottom up, which
...
...
common/lib/xmodule/xmodule/x_module.py
View file @
ce29b5ae
...
@@ -303,6 +303,10 @@ def policy_key(location):
...
@@ -303,6 +303,10 @@ def policy_key(location):
Get the key for a location in a policy file. (Since the policy file is
Get the key for a location in a policy file. (Since the policy file is
specific to a course, it doesn't need the full location url).
specific to a course, it doesn't need the full location url).
"""
"""
# Special case--we need to be able to override the url_name on a course,
# so special case where we look for the course descriptor
if
location
.
category
==
'course'
:
return
'course'
return
'{cat}/{name}'
.
format
(
cat
=
location
.
category
,
name
=
location
.
name
)
return
'{cat}/{name}'
.
format
(
cat
=
location
.
category
,
name
=
location
.
name
)
...
...
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