def _action_remove(self, conn, remove_action): obj = remove_action.get("remove") if "index" not in obj: raise StoreException("no index provided for remove action") if "id" not in obj and "query" not in obj: raise StoreException("no id or query provided for remove action") if "id" in obj: raw.delete(conn, obj.get("index"), obj.get("id")) elif "query" in obj: raw.delete_by_query(conn, obj.get("index"), obj.get("query"))
def delete(self, conn=None, type=None): if conn is None: conn = self.__conn__ # the record may be in any one of the read types, so we need to check them all types = self.get_read_types(type) # in the simple case of one type, just get on and issue the delete if len(types) == 1: raw.delete(conn, types[0], self.id) # otherwise, check all the types until we find the object, then issue the delete there for t in types: o = raw.get(conn, t, self.id) if o is not None: raw.delete(conn, t, self.id)
def delete(self, conn=None, type=None): if conn is None: conn = self._get_connection() # the record may be in any one of the read types, so we need to check them all if type is not None: if isinstance(type, list): types = type else: types = [type] else: types = self._get_read_types() # in the simple case of one type, just get on and issue the delete if len(types) == 1: raw.delete(conn, types[0], self.id) # otherwise, check all the types until we find the object, then issue the delete there for t in types: o = raw.get(conn, t, self.id) if o is not None: raw.delete(conn, t, self.id)