[Erp5-report] r39561 kazuhiko - /erp5/trunk/products/ERP5Type/ERP5Type.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Oct 27 14:06:10 CEST 2010


Author: kazuhiko
Date: Wed Oct 27 14:06:04 2010
New Revision: 39561

URL: http://svn.erp5.org?rev=39561&view=rev
Log:
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.

Modified:
    erp5/trunk/products/ERP5Type/ERP5Type.py

Modified: erp5/trunk/products/ERP5Type/ERP5Type.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/ERP5Type.py?rev=39561&r1=39560&r2=39561&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/ERP5Type.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/ERP5Type.py [utf8] Wed Oct 27 14:06:04 2010
@@ -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
 
 




More information about the Erp5-report mailing list