From 6a041ba8caa327faf68acc2c1260323e31fa1c14 Mon Sep 17 00:00:00 2001 From: zmsdev Date: Wed, 11 Dec 2024 13:12:35 +0100 Subject: [PATCH] workflow: CopyError during publishing #795 (#340) --- Products/zms/zmscontainerobject.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/Products/zms/zmscontainerobject.py b/Products/zms/zmscontainerobject.py index 94df6e6a5..2e0ca9b9e 100644 --- a/Products/zms/zmscontainerobject.py +++ b/Products/zms/zmscontainerobject.py @@ -247,30 +247,28 @@ def moveObjsToTrashcan(self, ids, REQUEST): if self.meta_id == 'ZMSTrashcan': return trashcan = self.getTrashcan() - # Set deletion-date. - ids_copy = [] + nodes = [] for id in ids: try: context = getattr(self, id) context.del_uid = str(REQUEST.get('AUTHENTICATED_USER', None)) context.del_dt = standard.getDateTime( time.time()) - ids_copy.append(id) + # Move (Cut & Paste). + children = [context] + [standard.triggerEvent(child,'beforeDeleteObjsEvt') for child in children] + cb_copy_data = _cb_decode(self.manage_cutObjects([id])) + trashcan.manage_pasteObjects(cb_copy_data=_cb_encode(cb_copy_data)) + [standard.triggerEvent(child,'afterDeleteObjsEvt') for child in children] + nodes.extend(children) except: standard.writeBlock( self, "[moveObjsToTrashcan]: Attribute Error %s"%(id)) - # Use only successfully tried ids - ids = ids_copy - # Move (Cut & Paste). - children = [getattr(self,x) for x in ids] - [standard.triggerEvent(child,'beforeDeleteObjsEvt') for child in children] - cb_copy_data = _cb_decode(self.manage_cutObjects(ids)) - trashcan.manage_pasteObjects(cb_copy_data=_cb_encode(cb_copy_data)) + # Synchronize search. + self.getCatalogAdapter().unindex_nodes(nodes=nodes) + # Trashcan: Sort-IDs and Garbage-Collection, trashcan.normalizeSortIds() trashcan.run_garbage_collection(forced=1) - # Synchronize search. - self.getCatalogAdapter().unindex_nodes(nodes=children) # Sort-IDs. self.normalizeSortIds() - [standard.triggerEvent(child,'afterDeleteObjsEvt') for child in children] ############################################################################