Commit d88724c6 authored by Vincent Pelletier's avatar Vincent Pelletier

Make sure _edit is called even if the created object is a temp object.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15165 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b3bfb063
...@@ -101,14 +101,12 @@ class FolderMixIn(ExtensionClass.Base): ...@@ -101,14 +101,12 @@ class FolderMixIn(ExtensionClass.Base):
if not getattr(container, 'isTempObject', lambda: 0)(): if not getattr(container, 'isTempObject', lambda: 0)():
factory_name = 'newTemp%s' %(portal_type.replace(' ', '')) factory_name = 'newTemp%s' %(portal_type.replace(' ', ''))
m = getattr(Document, factory_name) m = getattr(Document, factory_name)
return m(container, new_id) new_instance = m(container, new_id)
else:
myType = pt.getTypeInfo(container) myType = pt.getTypeInfo(container)
if myType is not None: if myType is not None and not myType.allowType( portal_type ) and \
if not myType.allowType( portal_type ): 'portal_trash' not in container.getPhysicalPath():
if not 'portal_trash' in container.getPhysicalPath():
raise ValueError('Disallowed subobject type: %s' % portal_type) raise ValueError('Disallowed subobject type: %s' % portal_type)
pt.constructContent( type_name=portal_type, pt.constructContent( type_name=portal_type,
container=container, container=container,
id=new_id, id=new_id,
...@@ -119,8 +117,8 @@ class FolderMixIn(ExtensionClass.Base): ...@@ -119,8 +117,8 @@ class FolderMixIn(ExtensionClass.Base):
# TODO :the **kw makes it impossible to create content not based on # TODO :the **kw makes it impossible to create content not based on
# ERP5TypeInformation, because factory method often do not support # ERP5TypeInformation, because factory method often do not support
# keywords arguments. # keywords arguments.
new_instance = container[new_id] new_instance = container[new_id]
if kw != {} : new_instance._edit(force_update=1, **kw) if kw != {} : new_instance._edit(force_update=1, **kw)
if immediate_reindex: new_instance.immediateReindexObject() if immediate_reindex: new_instance.immediateReindexObject()
return new_instance return new_instance
......
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