have XModuleDescriptor properly ensure category is set
This commit is contained in:
committed by
Chris Dodge
parent
0acc201a21
commit
03608a8931
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user