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
63298538
Commit
63298538
authored
Jun 21, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix and added comments
* wasn't passing namespace properly in parse_course_file
parent
83472453
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
lms/djangoapps/courseware/content_parser.py
+13
-5
No files found.
lms/djangoapps/courseware/content_parser.py
View file @
63298538
...
...
@@ -26,10 +26,13 @@ import xmodule
''' This file will eventually form an abstraction layer between the
course XML file and the rest of the system.
TODO: Shift everything from xml.dom.minidom to XPath (or XQuery)
'''
# ==== This section has no direct dependencies on django ====================================
# NOTE: it does still have some indirect dependencies:
# util.memcache.fasthash (which does not depend on memcache at all)
#
class
ContentException
(
Exception
):
pass
...
...
@@ -166,12 +169,15 @@ def parse_course_file(filename, options, namespace):
'''
Parse a course file with the given options, and return the resulting
xml tree object.
Options should be a dictionary including keys
'dev_content': bool,
'groups' : [list, of, user, groups]
namespace is used to in searching for the file. Could be e.g. 'course',
'sections'.
'''
xml
=
etree
.
XML
(
render_to_string
(
filename
,
options
,
namespace
=
'course'
))
xml
=
etree
.
XML
(
render_to_string
(
filename
,
options
,
namespace
=
namespace
))
return
course_xml_process
(
xml
)
...
...
@@ -197,7 +203,9 @@ def get_module(tree, module, id_tag, module_id, sections_dirname, options):
Given the xml tree of the course, get the xml string for a module
with the specified module type, id_tag, module_id. Looks in
sections_dirname for sections.
'''
id_tag -- use id_tag if the place the module stores its id is not 'id'
'''
# Sanitize input
if
not
module
.
isalnum
():
raise
Exception
(
"Module is not alphanumeric"
)
...
...
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