[Erp5-report] r39761 nicolas.dumazet - /erp5/trunk/products/ERP5Type/dynamic/dynamic_module.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Nov 2 11:37:14 CET 2010
Author: nicolas.dumazet
Date: Tue Nov 2 11:37:08 2010
New Revision: 39761
URL: http://svn.erp5.org?rev=39761&view=rev
Log:
add a comment as to why we test the type of the returned object
Modified:
erp5/trunk/products/ERP5Type/dynamic/dynamic_module.py
Modified: erp5/trunk/products/ERP5Type/dynamic/dynamic_module.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/dynamic/dynamic_module.py?rev=39761&r1=39760&r2=39761&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dynamic/dynamic_module.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/dynamic/dynamic_module.py [utf8] Tue Nov 2 11:37:08 2010
@@ -14,7 +14,9 @@ class DynamicModule(ModuleType):
if name == '__path__':
raise AttributeError('%s does not have __path__' % (self,))
obj = self._factory(name)
- if hasattr(obj, '__module__'):
+ # _factory can return an instance, a constant, or a class
+ if isinstance(obj, type):
+ # if it's a class we want to set __module__
obj.__module__ = self.__name__
setattr(self, name, obj)
return obj
More information about the Erp5-report
mailing list