api.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:bedrock-core 作者: Bedrock-py 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号