[Erp5-report] r43885 arnaud.fontaine - /erp5/trunk/products/ERP5Type/dynamic/dynamic_module.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Mar 2 12:12:57 CET 2011


Author: arnaud.fontaine
Date: Wed Mar  2 12:12:56 2011
New Revision: 43885

URL: http://svn.erp5.org?rev=43885&view=rev
Log:
A Dynamic Module may create modules as well, thus set the new module
name relative to the dynamic module name

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=43885&r1=43884&r2=43885&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dynamic/dynamic_module.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/dynamic/dynamic_module.py [utf8] Wed Mar  2 12:12:56 2011
@@ -21,6 +21,11 @@ class DynamicModule(ModuleType):
     if isinstance(obj, type):
       # if it's a class we want to set __module__
       obj.__module__ = self.__name__
+    elif isinstance(obj, ModuleType):
+      # if it's a module we want to set the name according to the
+      # module it's being added to
+      obj.__name__ = "%s.%s" % (self.__name__, name)
+
     setattr(self, name, obj)
     return obj
 



More information about the Erp5-report mailing list