From c0f12e69f7508e62645658e1aeae389094be7a23 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Thu, 27 Dec 2012 16:15:52 -0500 Subject: [PATCH] fixes on the export. There's some attributes not being handled correctly --- cms/templates/export.html | 6 ++++-- common/lib/xmodule/xmodule/html_module.py | 2 +- common/lib/xmodule/xmodule/xml_module.py | 11 +++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/cms/templates/export.html b/cms/templates/export.html index 3cf94b6728..2f41ad86df 100644 --- a/cms/templates/export.html +++ b/cms/templates/export.html @@ -26,16 +26,17 @@
-
+

Export Course:

- Download Files + Download Files
+ <%doc>

Export Course:

@@ -46,6 +47,7 @@

Download not start? Try again

+ diff --git a/common/lib/xmodule/xmodule/html_module.py b/common/lib/xmodule/xmodule/html_module.py index cae099845a..709f86bf45 100644 --- a/common/lib/xmodule/xmodule/html_module.py +++ b/common/lib/xmodule/xmodule/html_module.py @@ -160,7 +160,7 @@ class HtmlDescriptor(XmlDescriptor, EditingDescriptor): filepath = u'{category}/{pathname}.html'.format(category=self.category, pathname=pathname) - resource_fs.makedir(os.path.dirname(filepath), allow_recreate=True) + resource_fs.makedir(os.path.dirname(filepath), recursive=True, allow_recreate=True) with resource_fs.open(filepath, 'w') as file: file.write(self.definition['data']) diff --git a/common/lib/xmodule/xmodule/xml_module.py b/common/lib/xmodule/xmodule/xml_module.py index 91400b7e8a..38fcaddd20 100644 --- a/common/lib/xmodule/xmodule/xml_module.py +++ b/common/lib/xmodule/xmodule/xml_module.py @@ -99,6 +99,7 @@ class XmlDescriptor(XModuleDescriptor): metadata_to_strip = ('data_dir', # cdodge: @TODO: We need to figure out a way to export out 'tabs' and 'grading_policy' which is on the course 'tabs', 'grading_policy', 'is_draft', 'published_by', 'published_date', + 'discussion_blackouts', # VS[compat] -- remove the below attrs once everything is in the CMS 'course', 'org', 'url_name', 'filename') @@ -110,11 +111,17 @@ class XmlDescriptor(XModuleDescriptor): to_bool = lambda val: val == 'true' or val == True from_bool = lambda val: str(val).lower() bool_map = AttrMap(to_bool, from_bool) + + to_int = lambda val: int(val) + from_int = lambda val: str(val) + int_map = AttrMap(to_int, from_int) xml_attribute_map = { # type conversion: want True/False in python, "true"/"false" in xml 'graded': bool_map, 'hide_progress_tab': bool_map, - 'allow_anonymous': bool_map + 'allow_anonymous': bool_map, + 'allow_anonymous_to_peers': bool_map, + 'weight':int_map } @@ -364,7 +371,7 @@ class XmlDescriptor(XModuleDescriptor): # don't want e.g. data_dir if attr not in self.metadata_to_strip and attr not in self.metadata_to_export_to_policy: val = val_for_xml(attr) - # logging.debug('location.category = {0}, attr = {1}'.format(self.location.category, attr)) + #logging.debug('location.category = {0}, attr = {1}'.format(self.location.category, attr)) xml_object.set(attr, val) if self.export_to_file():