Python werkzeug 模块,LocalProxy() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用werkzeug.LocalProxy()

项目:omniduct    作者:airbnb    | 项目源码 | 文件源码
def schemas(self):
        from werkzeug import LocalProxy

        def get_schemas():
            if not getattr(self, '_schemas', None):
                self.connect()
                try:
                    from .schemas import Schemas
                    self._schemas = Schemas(self._sqlalchemy_metadata)
                except ImportError:
                    logger.warning('cannot import Schemas, perhaps sqlalchemy is not up to date')
            return self._schemas
        return LocalProxy(get_schemas)