Commit 97d6b818 authored by Yusei Tahara's avatar Yusei Tahara

EPR5Type.CopySupport: Support non-ERP5ish objects.

parent accf13dd
...@@ -506,12 +506,17 @@ class CopyContainer: ...@@ -506,12 +506,17 @@ class CopyContainer:
# Note: do not use __recurse as it only iterates over immediate content, # Note: do not use __recurse as it only iterates over immediate content,
# and then stop instead of calling itself into them. It relies on called # and then stop instead of calling itself into them. It relies on called
# methods to call it back, and we do not want that for _setUid . # methods to call it back, and we do not want that for _setUid .
# Basically this block of code is for ERP5ish objects only.
todo_list = [new_ob] todo_list = [new_ob]
while todo_list: while todo_list:
document = todo_list.pop() document = todo_list.pop()
todo_list.extend(document.objectValues()) todo_list.extend(document.objectValues())
todo_list.extend(document.opaqueValues()) opaqueValues = getattr(document, 'opaqueValues', None)
document._setUid(None) if opaqueValues is not None:
todo_list.extend(opaqueValues())
_setUid = getattr(document, '_setUid', None)
if _setUid is not None:
_setUid(None)
self._setObject(new_id, new_ob, set_owner=set_owner) self._setObject(new_id, new_ob, set_owner=set_owner)
new_ob = self._getOb(new_id) new_ob = self._getOb(new_id)
new_ob._postCopy(self, op=op) new_ob._postCopy(self, op=op)
......
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