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
cc09a902
Commit
cc09a902
authored
Jan 30, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DRY things up a bit
parent
c6760463
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
18 deletions
+15
-18
common/lib/xmodule/xmodule/modulestore/xml_exporter.py
+15
-18
No files found.
common/lib/xmodule/xmodule/modulestore/xml_exporter.py
View file @
cc09a902
...
@@ -18,24 +18,21 @@ def export_to_xml(modulestore, contentstore, course_location, root_dir, course_d
...
@@ -18,24 +18,21 @@ def export_to_xml(modulestore, contentstore, course_location, root_dir, course_d
contentstore
.
export_all_for_course
(
course_location
,
root_dir
+
'/'
+
course_dir
+
'/static/'
)
contentstore
.
export_all_for_course
(
course_location
,
root_dir
+
'/'
+
course_dir
+
'/static/'
)
# export the static tabs
# export the static tabs
static_tabs_query_loc
=
Location
(
'i4x'
,
course_location
.
org
,
course_location
.
course
,
'static_tab'
,
None
)
export_extra_content
(
export_fs
,
modulestore
,
course_location
,
'static_tab'
,
'tabs'
,
'.html'
)
static_tabs
=
modulestore
.
get_items
(
static_tabs_query_loc
)
# export the custom tags
if
len
(
static_tabs
)
>
0
:
export_extra_content
(
export_fs
,
modulestore
,
course_location
,
'custom_tag_template'
,
'custom_tags'
)
tab_dir
=
export_fs
.
makeopendir
(
'tabs'
)
for
tab
in
static_tabs
:
with
tab_dir
.
open
(
tab
.
location
.
name
+
'.html'
,
'w'
)
as
tab_file
:
def
export_extra_content
(
export_fs
,
modulestore
,
course_location
,
category_type
,
dirname
,
file_suffix
=
''
):
tab_file
.
write
(
tab
.
definition
[
'data'
]
.
encode
(
'utf8'
))
query_loc
=
Location
(
'i4x'
,
course_location
.
org
,
course_location
.
course
,
category_type
,
None
)
items
=
modulestore
.
get_items
(
query_loc
)
# export custom tags
custom_tags_query_loc
=
Location
(
'i4x'
,
course_location
.
org
,
course_location
.
course
,
'custom_tag_template'
,
None
)
if
len
(
items
)
>
0
:
custom_tags
=
modulestore
.
get_items
(
custom_tags_query_loc
)
item_dir
=
export_fs
.
makeopendir
(
dirname
)
for
item
in
items
:
if
len
(
custom_tags
)
>
0
:
with
item_dir
.
open
(
item
.
location
.
name
+
file_suffix
,
'w'
)
as
item_file
:
tab_dir
=
export_fs
.
makeopendir
(
'custom_tags'
)
item_file
.
write
(
item
.
definition
[
'data'
]
.
encode
(
'utf8'
))
for
tag
in
custom_tags
:
with
tab_dir
.
open
(
tag
.
location
.
name
,
'w'
)
as
tag_file
:
tag_file
.
write
(
tag
.
definition
[
'data'
]
.
encode
(
'utf8'
))
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