def remove(self): # FIXME: Need to remove associated orders in a better way #delete(Order.table).execute(oid=self.id) # Remove any parenting on this object. t = Object.table update(t, t.c.parent==self.id, {t.c.parent: 0}).execute() SQLTypedBase.remove(self)
def remove(self): trans = dbconn.begin() try: # Move the other orders down t = self.table update(t, (t.c.slot >= bindparam('s')) & (t.c.oid==bindparam('o')), {'slot': t.c.slot-1}).execute(s=self.slot, o=self.oid) self.object.save() SQLTypedBase.remove(self) trans.commit() except Exception, e: trans.rollback() raise
def remove(self): trans = dbconn.begin() try: # Move the other orders down t = self.table update(t, (t.c.slot >= bindparam('s')) & (t.c.oid == bindparam('o')), { 'slot': t.c.slot - 1 }).execute(s=self.slot, o=self.oid) self.object.save() SQLTypedBase.remove(self) trans.commit() except Exception, e: trans.rollback() raise