def delete(self, item): """ Mark a Item as deleted. The database delete operation occurs upon flush(). """ item = DBSession.query(Item).get(item.id) #next_item = item.next() if not item: raise ValueError("Did not find Item") #if _validate(item): with transaction.manager: DBSession.delete(item) return True return False #delete operation failed
def delete(self, supplier): """ Mark a Supplier as deleted. The database delete operation occurs upon flush(). """ supplier = DBSession.query(Supplier).get(supplier.id) #next_supplier = supplier.next() if not supplier: raise ValueError("Did not find Supplier") #if _validate(supplier): with transaction.manager: DBSession.delete(supplier) return True return False #delete operation failed
def delete_branch(self, j_branch): branch_id = j_branch.pop("suppliers_branch_id", None) if not branch_id: raise KeyError("Invalid Branch") branch = DBSession.query(SupplierBranch).get(branch_id) with transaction.manager: DBSession.delete(branch)