[Erp5-report] r19078 - /erp5/trunk/products/ERP5Type/ERP5Type.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Feb 5 19:17:39 CET 2008
Author: romain
Date: Tue Feb 5 19:17:39 2008
New Revision: 19078
URL: http://svn.erp5.org?rev=19078&view=rev
Log:
Initialize portal type (and aq_dynamic) on objects before setting the local roles and notifying
the workflows.
Modified:
erp5/trunk/products/ERP5Type/ERP5Type.py
Modified: erp5/trunk/products/ERP5Type/ERP5Type.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/ERP5Type.py?rev=19078&r1=19077&r2=19078&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/ERP5Type.py (original)
+++ erp5/trunk/products/ERP5Type/ERP5Type.py Tue Feb 5 19:17:39 2008
@@ -279,6 +279,11 @@
# Then keep on the construction process
ob = self._constructInstance(container, id, *args, **kw)
+ # Portal type has to be set before setting other attributes
+ # in order to initialize aq_dynamic
+ if hasattr(ob, '_setPortalTypeName'):
+ ob._setPortalTypeName(self.getId())
+
# Only try to assign roles to security groups if some roles are defined
# This is an optimisation to prevent defining local roles on subobjects
# which acquire their security definition from their parent
@@ -287,7 +292,13 @@
if len(self._roles):
self.updateLocalRolesOnSecurityGroups(ob)
- ob = self._finishConstruction(ob)
+ # notify workflow after generating local roles, in order to prevent
+ # Unauthorized error on transition's condition
+ if hasattr(aq_base(ob), 'notifyWorkflowCreated'):
+ ob.notifyWorkflowCreated()
+
+ # Reindex the object at the end
+ ob.reindexObject()
if self.init_script :
# Acquire the init script in the context of this object
More information about the Erp5-report
mailing list