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,26 +101,24 @@ class FolderMixIn(ExtensionClass.Base): ...@@ -101,26 +101,24 @@ 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,
container=container,
pt.constructContent( type_name=portal_type, id=new_id,
container=container, created_by_builder=created_by_builder,
id=new_id, activate_kw=activate_kw,
created_by_builder=created_by_builder, is_indexable=is_indexable
activate_kw=activate_kw, ) # **kw) removed due to CMF bug
is_indexable=is_indexable # TODO :the **kw makes it impossible to create content not based on
) # **kw) removed due to CMF bug # ERP5TypeInformation, because factory method often do not support
# TODO :the **kw makes it impossible to create content not based on # keywords arguments.
# ERP5TypeInformation, because factory method often do not support new_instance = container[new_id]
# keywords arguments.
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