def get(self, uid):
"""
Get a workflow from the backing database (mongo), special uid=='all' returns
the whole list. the workflow will be stored in the response as a json at the key workflow.
If you ask for 'all' then there will be a field 'workflows' containing an array of workflows.
"""
print('flow called')
client = db_client()[flowdb][flowcol]
resp = newresp(request, uid)
if uid == 'all':
try:
resp['workflows'] = map(serialize_id_key, client.find())
except Exception as ex:
print(ex)
return "failed builk read to mongo", 500
else:
try:
resp['workflow'] = serialize_id_key(client.find({'_id':ObjectId(uid)})[0])
except IndexError:
return 'No such object %s'%uid, 404
resp['mesg'] = "You asked for %s" % uid
return resp
评论列表
文章目录