def _applySecurity(self, oParent, trans):
     if self.inheritRoles:
         self.security = oParent.security
     if self.isCollection:
         cursor = None
         try:
             cursor = _db.query_index('_parentid', self._id, trans)
             cursor.fetch_all = True
             for child in cursor:
                 child._applySecurity(self, trans)
                 _db.put_item(child, trans)
         finally:
             if cursor != None:
                 cursor.close()
 def get_children(self, trans=None, resolve_shortcuts=False):
     """
     This method returns all the children of the container.
     
     @param trans: A valid transaction handle
     @rtype: L{ObjectSet<porcupine.core.objectSet.ObjectSet>}
     """
     cursor = None
     try:
         cursor = _db.query_index('_parentid', self._id, trans)
         cursor.resolve_shortcuts = resolve_shortcuts
         children = ObjectSet([c for c in cursor])
     finally:
         if cursor != None:
             cursor.close()
     return children
 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 _undelete(self, trans):
     """
     Undeletes a logically deleted item.
     Bypasses security checks.
     
     @return: None
     """
     if int(self._isDeleted) == 1:
         _db.handle_undelete(self, trans)
     
     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._undelete(trans) for child in cursor]
         finally:
             if cursor != None:
                 cursor.close()
     
     _db.put_item(self, trans)
 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)