[Erp5-report] r39615 jm - in /erp5/trunk/products/ERP5Type: ./ dynamic/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Oct 28 16:07:54 CEST 2010


Author: jm
Date: Thu Oct 28 16:07:51 2010
New Revision: 39615

URL: http://svn.erp5.org?rev=39615&view=rev
Log:
Fix some bootstrap issues

- fix recursive call of Base._aq_dynamic
- revert r39457 ("__of__ has no reason to trigger portal_type loading.")
- avoid problematic and useless interaction/reindexation
  while migrating a portal type

Steps to reproduce were:
0. make sure your browser is already logged (Manager may be required)
1. runUnitTest --save --portal_id=erp5 testBusinessTemplate
2. runUnitTest --load
3. open /erp5/portal_templates/view

Note: some errors were random.

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

Modified: erp5/trunk/products/ERP5Type/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?rev=39615&r1=39614&r2=39615&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Base.py [utf8] Thu Oct 28 16:07:51 2010
@@ -913,6 +913,7 @@ class Base( CopyContainer,
 
       # Generate Related Accessors
       if not Base.aq_related_generated:
+        Base.aq_related_generated = 1
         from Utils import createRelatedValueAccessors
         portal_types = getToolByName(portal, 'portal_types', None)
         generated_bid = set()
@@ -939,8 +940,6 @@ class Base( CopyContainer,
               createRelatedValueAccessors(None, bid)
               generated_bid.add(bid)
 
-        Base.aq_related_generated = 1
-
       # We suppose that if we reach this point
       # then it means that all code generation has succeeded
       # (no except should hide that). We can safely return None

Modified: erp5/trunk/products/ERP5Type/ERP5Type.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/ERP5Type.py?rev=39615&r1=39614&r2=39615&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/ERP5Type.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/ERP5Type.py [utf8] Thu Oct 28 16:07:51 2010
@@ -453,14 +453,9 @@ class ERP5TypeInformation(XMLObject,
         init_script = self.getTypeFactoryMethodId()
         if init_script and init_script.startswith('add'):
           base = init_script[3:]
-          # and of course migrate the property
-          try:
-            self.setTypeClass(base)
-          except KeyError:
-            # Unfortunately, the above setter may trigger an interaction,
-            # but the interaction workflow may not be present yet at the
-            # bootstrap time, thus simply ignore such an error for now.
-            pass
+          # and of course migrate the property,
+          # avoiding any useless interaction/reindexation
+          self.type_class = base
       return base
 
     security.declareProtected(Permissions.AccessContentsInformation,

Modified: erp5/trunk/products/ERP5Type/dynamic/lazy_class.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/dynamic/lazy_class.py?rev=39615&r1=39614&r2=39615&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dynamic/lazy_class.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/dynamic/lazy_class.py [utf8] Thu Oct 28 16:07:51 2010
@@ -59,10 +59,11 @@ def generateLazyPortalTypeClass(portal_t
             Because __bases__ is changed, the behavior of this object
             will change after the first call.
             """
+            # Class must be loaded if '__of__' is requested because otherwise,
+            # next call to __getattribute__ would lose any acquisition wrapper.
             if attr in ('__class__',
                         '__getnewargs__',
                         '__getstate__',
-                        '__of__',
                         '__dict__',
                         '__module__',
                         '__name__',




More information about the Erp5-report mailing list