def delete_task(self, args): try: task = session.query(Task).filter_by(id=args.get('id')[0]).first() session.delete(task) session.commit() # still haven't decided on a pattern for this class, as you can see return True except: raise Exception("Could not delete task base on args: %s" % args)
def get_task(self, task_id): task = session.query(Task).filter_by(id=task_id).first() raise gen.Return(task)
def get_tasks(self): """Returns a list of tasks available""" all_tasks = session.query(Task).all() session.flush() raise gen.Return(all_tasks)