Commit a8ec376a authored by Sebastien Robin's avatar Sebastien Robin

set activity_kw volatile attribute at the time of the construction of the...

set activity_kw volatile attribute at the time of the construction of the klass, so we can put back previous version of ERP5Type


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4497 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 51f2e408
...@@ -169,7 +169,7 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ): ...@@ -169,7 +169,7 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ):
# #
security.declarePublic('constructInstance') security.declarePublic('constructInstance')
def constructInstance( self, container, id, bypass_init_script=0, def constructInstance( self, container, id, bypass_init_script=0,
activate_kw=None,*args, **kw ): *args, **kw ):
""" """
Build a "bare" instance of the appropriate type in Build a "bare" instance of the appropriate type in
'container', using 'id' as its id. 'container', using 'id' as its id.
...@@ -178,23 +178,8 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ): ...@@ -178,23 +178,8 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ):
Returns the object. Returns the object.
""" """
# This is part is copied from CMFCore/TypesTool # This is part is copied from CMFCore/TypesTool
# because we want to specify activate_kw before ob = FactoryTypeInformation.constructInstance(
# finishConstruction, so before reindexing self, container, id, *args, **kw)
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)
# Only try to assign roles to secutiry groups if some roles are defined # Only try to assign roles to secutiry groups if some roles are defined
# This is an optimisation to prevent defining local roles on subobjects # This is an optimisation to prevent defining local roles on subobjects
......
...@@ -309,8 +309,10 @@ class DocumentConstructor(Method): ...@@ -309,8 +309,10 @@ class DocumentConstructor(Method):
def __init__(self, klass): def __init__(self, klass):
self.klass = klass self.klass = klass
def __call__(self, folder, id, REQUEST=None, **kw): def __call__(self, folder, id, REQUEST=None, activate_kw=None,**kw):
o = self.klass(id) o = self.klass(id)
if activate_kw is not None:
o._v_activate_kw = activate_kw
folder._setObject(id, o) folder._setObject(id, o)
o.uid = folder.portal_catalog.newUid() o.uid = folder.portal_catalog.newUid()
#LOG('DocumentConstructor', 0, 'o = %r, kw = %r' % (o, kw)) #LOG('DocumentConstructor', 0, 'o = %r, kw = %r' % (o, kw))
......
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