__init__.py 文件源码

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

项目:peter_sslers 作者: aptise 项目源码 文件源码
def includeme(config):
    """
    Initialize the model for a Pyramid app.

    Activate this setup using ``config.include('peter_sslers.models')``.

    """
    settings = config.get_settings()

    # use pyramid_tm to hook the transaction lifecycle to the request
    config.include('pyramid_tm')

    session_factory = get_session_factory(get_engine(settings))
    config.registry['dbsession_factory'] = session_factory

    # make request.dbsession available for use in Pyramid
    config.add_request_method(
        # r.tm is the transaction manager used by pyramid_tm
        lambda r: get_tm_session(session_factory, r.tm),
        'dbsession',
        reify=True
    )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号