예제 #1
0
 def post(idict=None):
     session = Session()
     if not idict:
         idict = json.loads(request.data)
     obj = cmds_(**idict)
     session.add(obj)
     session.commit()
     odict = obj2dict(obj)
     session.close()
     return odict, 200
예제 #2
0
 def get(filterDict={}):
     try:
         filterDict = dict(request.args.items())
     except:
         pass
     session = Session()
     ts = session.query(tasks_).filter_by(**filterDict).order_by(
         tasks_.taskid).all()
     ts = [obj2dict(t) for t in ts]
     session.close()
     return ts
예제 #3
0
 def get(mid):
     session = Session()
     m = session.query(macs_).filter(macs_.macid==mid).first()
     md = obj2dict(m)    
     session.close() 
     return md,200
예제 #4
0
 def get():
     session = Session()
     ms = session.query(macs_).all()
     mlist = [obj2dict(m) for m in ms]
     session.close()
     return mlist,200
예제 #5
0
 def get(cid):
     session = Session()
     out = session.query(cmds_).filter(cmds_.cid == cid).first()
     out = obj2dict(out)
     session.close()
     return out, 200
예제 #6
0
 def get():
     session = Session()
     outs = session.query(cmds_).all()
     outs = [obj2dict(out) for out in outs]
     session.close()
     return outs, 200
예제 #7
0
 def get(tid):
     session = Session()
     m = session.query(tasks_).filter(tasks_.taskid == tid).first()
     m = obj2dict(m)
     session.close()
     return m, 200