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
c8deb48f
Commit
c8deb48f
authored
Jul 02, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make XML import pass in an empty render_template function
parent
70bfc703
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
common/lib/xmodule/xmodule/modulestore/xml.py
+10
-2
common/lib/xmodule/xmodule/x_module.py
+2
-2
No files found.
common/lib/xmodule/xmodule/modulestore/xml.py
View file @
c8deb48f
...
...
@@ -4,6 +4,7 @@ from importlib import import_module
from
lxml
import
etree
from
path
import
path
from
xmodule.x_module
import
XModuleDescriptor
,
XMLParsingSystem
from
xmodule.mako_module
import
MakoDescriptorSystem
from
.
import
ModuleStore
,
Location
from
.exceptions
import
ItemNotFoundError
...
...
@@ -38,7 +39,7 @@ class XMLModuleStore(ModuleStore):
self
.
default_class
=
class_
with
open
(
self
.
data_dir
/
"course.xml"
)
as
course_file
:
class
ImportSystem
(
XMLParsingSystem
):
class
ImportSystem
(
XMLParsingSystem
,
MakoDescriptorSystem
):
def
__init__
(
self
,
modulestore
):
"""
modulestore: the XMLModuleStore to store the loaded modules in
...
...
@@ -73,7 +74,14 @@ class XMLModuleStore(ModuleStore):
module
.
get_children
()
return
module
XMLParsingSystem
.
__init__
(
self
,
modulestore
.
get_item
,
OSFS
(
data_dir
),
process_xml
)
system_kwargs
=
dict
(
render_template
=
lambda
:
''
,
load_item
=
modulestore
.
get_item
,
resources_fs
=
OSFS
(
data_dir
),
process_xml
=
process_xml
)
MakoDescriptorSystem
.
__init__
(
self
,
**
system_kwargs
)
XMLParsingSystem
.
__init__
(
self
,
**
system_kwargs
)
self
.
course
=
ImportSystem
(
self
)
.
process_xml
(
course_file
.
read
())
...
...
common/lib/xmodule/xmodule/x_module.py
View file @
c8deb48f
...
...
@@ -422,7 +422,7 @@ class XModuleDescriptor(Plugin):
class
DescriptorSystem
(
object
):
def
__init__
(
self
,
load_item
,
resources_fs
):
def
__init__
(
self
,
load_item
,
resources_fs
,
**
kwargs
):
"""
load_item: Takes a Location and returns an XModuleDescriptor
resources_fs: A Filesystem object that contains all of the
...
...
@@ -434,7 +434,7 @@ class DescriptorSystem(object):
class
XMLParsingSystem
(
DescriptorSystem
):
def
__init__
(
self
,
load_item
,
resources_fs
,
process_xml
):
def
__init__
(
self
,
load_item
,
resources_fs
,
process_xml
,
**
kwargs
):
"""
process_xml: Takes an xml string, and returns the the XModuleDescriptor created from that xml
"""
...
...
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