From 71de34fca3a8a7887fdbcd63df3471f1e8f8bbc6 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Thu, 15 Aug 2013 16:24:54 -0400 Subject: [PATCH] use same getattr pattern in the XModule constructor that exists in the XModuleDescriptor --- common/lib/xmodule/xmodule/x_module.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/x_module.py b/common/lib/xmodule/xmodule/x_module.py index 4b22ae9fe2..87d9413334 100644 --- a/common/lib/xmodule/xmodule/x_module.py +++ b/common/lib/xmodule/xmodule/x_module.py @@ -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()