diff --git a/acceptance_tests/app/c2cwsgiutils_app/models.py b/acceptance_tests/app/c2cwsgiutils_app/models.py index 408403f7b..6ba531cb0 100644 --- a/acceptance_tests/app/c2cwsgiutils_app/models.py +++ b/acceptance_tests/app/c2cwsgiutils_app/models.py @@ -10,7 +10,7 @@ def init(config): global DBSession DBSession = db.setup_session(config, 'sqlalchemy', 'sqlalchemy_slave', force_slave=[ "POST /api/hello" - ]) + ])[0] class Hello(Base): diff --git a/c2cwsgiutils/db.py b/c2cwsgiutils/db.py index 49e124065..1c0ec0729 100644 --- a/c2cwsgiutils/db.py +++ b/c2cwsgiutils/db.py @@ -33,7 +33,7 @@ def setup_session(config, master_prefix, slave_prefix="", force_master=None, for settings :param force_master: The method/paths that needs to use the master :param force_slave: The method/paths that needs to use the slave - :return: The SQLAlchemy session + :return: The SQLAlchemy session, the R/W engine and the R/O engine """ def db_chooser_tween_factory(handler, registry): """ @@ -78,4 +78,4 @@ def db_chooser_tween(request): db_session = sqlalchemy.orm.scoped_session( sqlalchemy.orm.sessionmaker(extension=ZopeTransactionExtension(), bind=rw_engine)) - return db_session + return db_session, rw_engine, ro_engine