graph.py 文件源码

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

项目:flask_ogm 作者: DomWeldon 项目源码 文件源码
def get_connection(self, bind=None):
        """Return a py2neo.Graph object based on config settings"""
        # assume default if no bind specified
        if bind is None:
            bind = self.DEFAULT_GRAPH_KEY
        # credentials are bound to the application context
        ctx = stack.top
        if ctx is not None:
            if not hasattr(ctx, 'ogm_graphs'.format(bind)):
                ctx.ogm_graphs = {}
            if bind not in ctx.ogm_graphs:
                ctx.ogm_graphs[bind] = self.connect(bind=bind)

            return ctx.ogm_graphs[bind]

        raise OutOfApplicationContextError()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号