Commit 03608a89 by Don Mitchell Committed by Chris Dodge

have XModuleDescriptor properly ensure category is set

parent 0acc201a
......@@ -215,10 +215,6 @@ class VideoDescriptor(VideoFields, TabsEditingDescriptor, EmptyDataRawDescriptor
self._model_data.update(model_data)
del self.data
# I'm not sure how, but in some lifecycles we can loose the .category attribute
# this needs to be investigated
self.category = 'video'
@classmethod
def from_xml(cls, xml_data, system, org=None, course=None):
"""
......
......@@ -467,11 +467,11 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock):
self.system = self.runtime
if isinstance(self.location, Location):
self.url_name = self.location.name
if not hasattr(self, 'category'):
if getattr(self, 'category', None) is None:
self.category = self.location.category
elif isinstance(self.location, BlockUsageLocator):
self.url_name = self.location.usage_id
if not hasattr(self, 'category'):
if getattr(self, 'category', None) is None:
raise InsufficientSpecificationError()
else:
raise InsufficientSpecificationError()
......
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