Commit e12f1516 authored by Julien Muchembled's avatar Julien Muchembled

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.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39615 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 90dadd04
......@@ -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
......
......@@ -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,
......
......@@ -59,10 +59,11 @@ def generateLazyPortalTypeClass(portal_type_name,
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__',
......
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