Commit c0f12e69 by Chris Dodge

fixes on the export. There's some attributes not being handled correctly

parent 239b118a
...@@ -26,16 +26,17 @@ ...@@ -26,16 +26,17 @@
<!-- default state --> <!-- default state -->
<div class="export-form-wrapper"> <div class="export-form-wrapper">
<form action="${reverse('export_course', kwargs=dict(org=context_course.location.org, course=context_course.location.course, name=context_course.location.name))}" method="post" enctype="multipart/form-data" class="export-form"> <form action="${reverse('generate_export_course', kwargs=dict(org=context_course.location.org, course=context_course.location.course, name=context_course.location.name))}" method="post" enctype="multipart/form-data" class="export-form">
<h2>Export Course:</h2> <h2>Export Course:</h2>
<p class="error-block"></p> <p class="error-block"></p>
<a href="#" class="button-export">Download Files</a> <a href="${reverse('generate_export_course', kwargs=dict(org=context_course.location.org, course=context_course.location.course, name=context_course.location.name))}" class="button-export">Download Files</a>
</form> </form>
</div> </div>
<!-- download state: after user clicks download buttons --> <!-- download state: after user clicks download buttons -->
<%doc>
<div class="export-form-wrapper is-downloading"> <div class="export-form-wrapper is-downloading">
<form action="${reverse('export_course', kwargs=dict(org=context_course.location.org, course=context_course.location.course, name=context_course.location.name))}" method="post" enctype="multipart/form-data" class="export-form"> <form action="${reverse('export_course', kwargs=dict(org=context_course.location.org, course=context_course.location.course, name=context_course.location.name))}" method="post" enctype="multipart/form-data" class="export-form">
<h2>Export Course:</h2> <h2>Export Course:</h2>
...@@ -46,6 +47,7 @@ ...@@ -46,6 +47,7 @@
<p class="message-status">Download not start? <a href="#" class="text-export">Try again</a></p> <p class="message-status">Download not start? <a href="#" class="text-export">Try again</a></p>
</form> </form>
</div> </div>
</%doc>
</article> </article>
</div> </div>
</div> </div>
......
...@@ -160,7 +160,7 @@ class HtmlDescriptor(XmlDescriptor, EditingDescriptor): ...@@ -160,7 +160,7 @@ class HtmlDescriptor(XmlDescriptor, EditingDescriptor):
filepath = u'{category}/{pathname}.html'.format(category=self.category, filepath = u'{category}/{pathname}.html'.format(category=self.category,
pathname=pathname) 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: with resource_fs.open(filepath, 'w') as file:
file.write(self.definition['data']) file.write(self.definition['data'])
......
...@@ -99,6 +99,7 @@ class XmlDescriptor(XModuleDescriptor): ...@@ -99,6 +99,7 @@ class XmlDescriptor(XModuleDescriptor):
metadata_to_strip = ('data_dir', 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 # 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', 'tabs', 'grading_policy', 'is_draft', 'published_by', 'published_date',
'discussion_blackouts',
# VS[compat] -- remove the below attrs once everything is in the CMS # VS[compat] -- remove the below attrs once everything is in the CMS
'course', 'org', 'url_name', 'filename') 'course', 'org', 'url_name', 'filename')
...@@ -110,11 +111,17 @@ class XmlDescriptor(XModuleDescriptor): ...@@ -110,11 +111,17 @@ class XmlDescriptor(XModuleDescriptor):
to_bool = lambda val: val == 'true' or val == True to_bool = lambda val: val == 'true' or val == True
from_bool = lambda val: str(val).lower() from_bool = lambda val: str(val).lower()
bool_map = AttrMap(to_bool, from_bool) 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 = { xml_attribute_map = {
# type conversion: want True/False in python, "true"/"false" in xml # type conversion: want True/False in python, "true"/"false" in xml
'graded': bool_map, 'graded': bool_map,
'hide_progress_tab': 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): ...@@ -364,7 +371,7 @@ class XmlDescriptor(XModuleDescriptor):
# don't want e.g. data_dir # 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: if attr not in self.metadata_to_strip and attr not in self.metadata_to_export_to_policy:
val = val_for_xml(attr) 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) xml_object.set(attr, val)
if self.export_to_file(): if self.export_to_file():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment