Return DatabaseManager or DatabaseMaster depending on DISABLE_GLOBALS
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 30 Nov 2014 19:53:21 +0000 (13:53 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Wed, 3 Dec 2014 21:40:57 +0000 (15:40 -0600)
They're both similar!  One sets up sessions, one grabs sessions from a global object.

mediagoblin/db/open.py

index 4b4dfa12089c20422c79d79e9c9b3d73a6e46fa0..9922cc1053aaaa46f2d906fe53ee53c015cb2f89 100644 (file)
@@ -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):