Ejemplo n.º 1
0
def includeme(config):
    # Add a directive to get an alembic configuration.
    config.add_directive("alembic_config", _configure_alembic)

    # Create our SQLAlchemy Engine.
    config.registry["sqlalchemy.engine"] = sqlalchemy.create_engine(
        config.registry.settings["database.url"],
        isolation_level="SERIALIZABLE",
    )

    # Register our request.db property
    config.add_request_method(_create_session, name="db", reify=True)

    # Add a route predicate to mark a route as read only.
    config.add_route_predicate("read_only", ReadOnlyPredicate)
Ejemplo n.º 2
0
def includeme(config):
    # Add a directive to get an alembic configuration.
    config.add_directive("alembic_config", _configure_alembic)

    # Create our SQLAlchemy Engine.
    config.registry["sqlalchemy.engine"] = sqlalchemy.create_engine(
        config.registry.settings["database.url"],
        isolation_level="SERIALIZABLE",
    )

    # Register our request.db property
    config.add_request_method(_create_session, name="db", reify=True)

    # Add a route predicate to mark a route as read only.
    config.add_route_predicate("read_only", ReadOnlyPredicate)
Ejemplo n.º 3
0
def includeme(config):
    # Add a directive to get an alembic configuration.
    config.add_directive("alembic_config", _configure_alembic)

    # Create our SQLAlchemy Engine.
    config.registry["sqlalchemy.engine"] = _create_engine(
        config.registry.settings["database.url"])

    # Register our request.db property
    config.add_request_method(_create_session, name="db", reify=True)

    # Add a route predicate to mark a route as read only.
    config.add_route_predicate("read_only", ReadOnlyPredicate)

    # Add a request.read_only property which can be used to determine if a
    # request is being acted upon as a read-only request or not.
    config.add_request_method(_readonly, name="read_only", reify=True)
Ejemplo n.º 4
0
def includeme(config):
    # Add a directive to get an alembic configuration.
    config.add_directive("alembic_config", _configure_alembic)

    # Create our SQLAlchemy Engine.
    config.registry["sqlalchemy.engine"] = _create_engine(
        config.registry.settings["database.url"],
    )

    # Register our request.db property
    config.add_request_method(_create_session, name="db", reify=True)

    # Add a route predicate to mark a route as read only.
    config.add_route_predicate("read_only", ReadOnlyPredicate)

    # Add a request.read_only property which can be used to determine if a
    # request is being acted upon as a read-only request or not.
    config.add_request_method(_readonly, name="read_only", reify=True)