From 63f6a418d1333e15522ec00be13d1525b68f36f5 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 30 Nov 2014 13:53:21 -0600 Subject: [PATCH] Return DatabaseManager or DatabaseMaster depending on DISABLE_GLOBALS They're both similar! One sets up sessions, one grabs sessions from a global object. --- mediagoblin/db/open.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mediagoblin/db/open.py b/mediagoblin/db/open.py index 4b4dfa12..9922cc10 100644 --- a/mediagoblin/db/open.py +++ b/mediagoblin/db/open.py @@ -142,9 +142,13 @@ def setup_connection_and_db_from_config(app_config, migrations=False): # logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO) - Session.configure(bind=engine) + if DISABLE_GLOBALS: + return DatabaseManager(engine) - return DatabaseMaster(engine) + else: + Session.configure(bind=engine) + + return DatabaseMaster(engine) def check_db_migrations_current(db): -- 2.25.1