Commit b7062ca5 by Calen Pennington

Only set the xml slug if it isn't already set

parent 8a64029b
...@@ -40,11 +40,12 @@ class XMLModuleStore(ModuleStore): ...@@ -40,11 +40,12 @@ class XMLModuleStore(ModuleStore):
except: except:
log.exception("Unable to parse xml: {xml}".format(xml=xml)) log.exception("Unable to parse xml: {xml}".format(xml=xml))
raise raise
if xml_data.get('name'): if xml_data.get('slug') is None:
xml_data.set('slug', Location.clean(xml_data.get('name'))) if xml_data.get('name'):
else: xml_data.set('slug', Location.clean(xml_data.get('name')))
self.unnamed_modules += 1 else:
xml_data.set('slug', '{tag}_{count}'.format(tag=xml_data.tag, count=self.unnamed_modules)) self.unnamed_modules += 1
xml_data.set('slug', '{tag}_{count}'.format(tag=xml_data.tag, count=self.unnamed_modules))
module = XModuleDescriptor.load_from_xml(etree.tostring(xml_data), self, org, course, modulestore.default_class) module = XModuleDescriptor.load_from_xml(etree.tostring(xml_data), self, org, course, modulestore.default_class)
modulestore.modules[module.location] = module modulestore.modules[module.location] = module
......
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