[Erp5-report] r40202 nicolas.dumazet - /erp5/trunk/products/ERP5Type/dynamic/lazy_class.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Nov 11 04:34:12 CET 2010


Author: nicolas.dumazet
Date: Thu Nov 11 04:34:11 2010
New Revision: 40202

URL: http://svn.erp5.org?rev=40202&view=rev
Log:
do not override ghostbase if it's already set.

It can happen in recursive calls to loadClass, when generating accessor holders:
innermost call will return from getPortalTypeClass, will save the ghost base.
And then, when outer calls return as well, they need not save the ghost.

Modified:
    erp5/trunk/products/ERP5Type/dynamic/lazy_class.py

Modified: erp5/trunk/products/ERP5Type/dynamic/lazy_class.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/dynamic/lazy_class.py?rev=40202&r1=40201&r2=40202&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dynamic/lazy_class.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/dynamic/lazy_class.py [utf8] Thu Nov 11 04:34:11 2010
@@ -136,7 +136,11 @@ class PortalTypeMetaClass(ExtensionClass
 
 
     # save the old bases to be able to restore a ghost state later
-    klass.__ghostbase__ = klass.__bases__
+    if not hasattr(klass, '__ghostbase__'):
+      # but only do it if we're in the innermost call, otherwise
+      # klass.__bases__ might just be the Document without accessor
+      # holders, and we would override the real ghost class
+      klass.__ghostbase__ = klass.__bases__
     klass.__bases__ = base_list
 
     for key, value in attribute_dict.iteritems():




More information about the Erp5-report mailing list