def _delete(self, trans): """ Deletes the item physically. Bypasses security checks. Returns: None """ db.handle_delete(self, trans, True) db.deleteItem(self, trans) if self.isCollection: lstChildren = self._items.values() + self._subfolders.values() for sID in lstChildren: oChild = db.getItem(sID, trans) oChild._delete(trans)
def on_delete(item, attr, trans, bPermanent): if bPermanent: if item._isDeleted: func_get = db.getDeletedItem else: func_get = db.getItem composites = [func_get(sID, trans) for sID in attr.value] for composite in composites: CompositionEventHandler.removeComposite(composite, trans) else: for sID in attr.value: composite = db.getItem(sID, trans) db.handle_delete(composite, trans, False) composite._isDeleted = True db.putItem(composite, trans)
def _recycle(self, trans): """ Removes an item's references and marks it as deleted. Returns: None """ db.handle_delete(self, trans, False) self._isDeleted = True if self.isCollection: lstChildren = self._items.values() + self._subfolders.values() for sID in lstChildren: oChild = db.getItem(sID, trans) oChild._recycle(trans) db.putItem(self, trans)
def removeComposite(composite, trans): db.handle_delete(composite, trans, True) db.deleteItem(composite, trans)