[Erp5-report] r40308 jm - /erp5/trunk/products/ERP5/ERP5Site.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Nov 16 21:27:26 CET 2010


Author: jm
Date: Tue Nov 16 21:27:26 2010
New Revision: 40308

URL: http://svn.erp5.org?rev=40308&view=rev
Log:
Make ERP5Site.__of__ check if given parent is real container

Unfortunately, this requires to create ERP5 sites at the root.

The fixes the following test case:
  transaction.commit()
  repr(portal.__dict__['_components'])

Modified:
    erp5/trunk/products/ERP5/ERP5Site.py

Modified: erp5/trunk/products/ERP5/ERP5Site.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/ERP5Site.py?rev=40308&r1=40307&r2=40308&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/ERP5Site.py [utf8] (original)
+++ erp5/trunk/products/ERP5/ERP5Site.py [utf8] Tue Nov 16 21:27:26 2010
@@ -17,6 +17,7 @@
 
 import threading
 from weakref import ref as weakref
+from OFS.Application import Application
 from Products.ERP5Type import Globals
 from Products.ERP5Type.Globals import package_home
 
@@ -258,7 +259,9 @@ class ERP5Site(FolderMixIn, CMFSite, Cac
     # Use a transactional variable for performance reason,
     # since ERP5Site.__of__ is called quite often.
     tv = getTransactionalVariable()
-    if 'ERP5Site.__of__' not in tv:
+    # Check 'parent' is the root because some objects like '_components'
+    # store the site in '__parent__'.
+    if 'ERP5Site.__of__' not in tv and type(parent) is Application:
       tv['ERP5Site.__of__'] = None
       setSite(self)
       synchronizeDynamicModules(self)




More information about the Erp5-report mailing list