use same getattr pattern in the XModule constructor that exists in the XModuleDescriptor
This commit is contained in:
@@ -173,11 +173,11 @@ class XModule(XModuleFields, HTMLSnippet, XBlock):
|
||||
# don't need to set category as it will automatically get from descriptor
|
||||
elif 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