Commit 96860682 authored by Sebastien Robin's avatar Sebastien Robin

modified constructInstance so that we can specify activity parameters as a...

modified constructInstance so that we can specify activity parameters as a volatile attribute before the object is reindexed


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4451 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c7952b53
No related merge requests found
......@@ -168,7 +168,8 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ):
# Agent methods
#
security.declarePublic('constructInstance')
def constructInstance( self, container, id, bypass_init_script=0, *args, **kw ):
def constructInstance( self, container, id, bypass_init_script=0,
activate_kw=None,*args, **kw ):
"""
Build a "bare" instance of the appropriate type in
'container', using 'id' as its id.
......@@ -176,8 +177,24 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ):
keyword arg __bypass_init_script is set to True.
Returns the object.
"""
ob = FactoryTypeInformation.constructInstance(
self, container, id, *args, **kw)
# This is part is copied from CMFCore/TypesTool
# because we want to specify activate_kw before
# finishConstruction, so before reindexing
m = self._getFactoryMethod(container)
id = str(id)
if getattr( m, 'isDocTemp', 0 ):
args = ( m.aq_parent, self.REQUEST ) + args
kw[ 'id' ] = id
else:
args = ( id, ) + args
id = apply( m, args, kw ) or id # allow factory to munge ID
ob = container._getOb( id )
if activate_kw is not None:
ob._v_activate_kw = activate_kw
LOG('ERP5Type.constructInstance new_ob._v_activate_kw',0,ob._v_activate_kw)
self._finishConstruction(ob)
if bypass_init_script :
return ob
......
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