def on_delete(item, attr, trans, bPermanent):
     if bPermanent:
         [CompositionEventHandler._removeComposite(_db.get_item(id, trans),
                                                   trans)
          for id in attr.value]
     else:
         for sID in attr.value:
             composite = _db.get_item(sID, trans)
             _db.handle_delete(composite, trans, False)
             composite._isDeleted = 1
             _db.put_item(composite, trans)
 def on_delete(cls, 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:
             cls.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 _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 _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 _delete(self, trans):
     """
     Deletes the item physically.
     
     @param trans: A valid transaction handle
     @return: None
     """
     _db.handle_delete(self, trans, True)
     _db.delete_item(self, trans)
     
     if self.isCollection:
         cursor = None
         try:
             cursor = _db.query_index('_parentid', self._id, trans)
             cursor.fetch_all = True
             [child._delete(trans) for child in cursor]
         finally:
             if cursor != None:
                 cursor.close()
 def _recycle(self, trans):
     """
     Deletes an item logically.
     Bypasses security checks.
     
     @return: None
     """
     if not self._isDeleted:
         _db.handle_delete(self, trans, False)
     
     self._isDeleted = int(self._isDeleted) + 1
     
     if self.isCollection:
         cursor = None
         try:
             cursor = _db.query_index('_parentid', self._id, trans)
             cursor.fetch_all = True
             [child._recycle(trans) for child in cursor]
         finally:
             if cursor != None:
                 cursor.close()
     
     _db.put_item(self, trans)
 def _removeComposite(composite, trans):
     _db.handle_delete(composite, trans, True)
     _db.delete_item(composite, trans)
 def removeComposite(cls, composite, trans):
     _db.handle_delete(composite, trans, True)
     _db.deleteItem(composite, trans)