Commit d9c5858f authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

now asContext().isTempObject() is True, but in such case...

now asContext().isTempObject() is True, but in such case container._setObject(id, ob.aq_base) will raises the folloing exception if it is called twice or more:
BadRequest: The id "xxx" is invalid - it is already in use.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39561 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 956fe3db
......@@ -317,9 +317,13 @@ class ERP5TypeInformation(XMLObject,
All ERP5Type.Document.newTempXXXX are constructTempInstance methods
"""
# you should not pass temp_object to constructTempInstance
ob = self.constructInstance(container, id, temp_object=1, *args, **kw)
if container.isTempObject():
original_container = container.getOriginalDocument()
if original_container is None
ob = self.constructInstance(container, id, temp_object=1, *args, **kw)
container._setObject(id, ob.aq_base)
else:
ob = self.constructInstance(original_container, id, temp_object=1,
*args, **kw)
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