Commit 71de34fc by Chris Dodge

use same getattr pattern in the XModule constructor that exists in the XModuleDescriptor

parent 03608a89
...@@ -173,11 +173,11 @@ class XModule(XModuleFields, HTMLSnippet, XBlock): ...@@ -173,11 +173,11 @@ class XModule(XModuleFields, HTMLSnippet, XBlock):
# don't need to set category as it will automatically get from descriptor # don't need to set category as it will automatically get from descriptor
elif isinstance(self.location, Location): elif isinstance(self.location, Location):
self.url_name = self.location.name self.url_name = self.location.name
if not hasattr(self, 'category'): if getattr(self, 'category', None) is None:
self.category = self.location.category self.category = self.location.category
elif isinstance(self.location, BlockUsageLocator): elif isinstance(self.location, BlockUsageLocator):
self.url_name = self.location.usage_id self.url_name = self.location.usage_id
if not hasattr(self, 'category'): if getattr(self, 'category', None) is None:
raise InsufficientSpecificationError() raise InsufficientSpecificationError()
else: else:
raise InsufficientSpecificationError() 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