Commit b2d32039 authored by Julien Muchembled's avatar Julien Muchembled

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'])

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40308 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b094c727
......@@ -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, CacheCookieMixin):
# 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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment