aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/base.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2014-12-03 13:13:58 -0600
committerChristopher Allan Webber <cwebber@dustycloud.org>2014-12-03 15:40:58 -0600
commit7c563e91bf66b0c01dfceb65c614b0da84ed91c3 (patch)
tree9002b481acd2df89297d8e48000a84ea885879d4 /mediagoblin/db/base.py
parent5e5ea4a3e97c14c377b7f2a82dc7d2558c14dcee (diff)
downloadmediagoblin-7c563e91bf66b0c01dfceb65c614b0da84ed91c3.tar.lz
mediagoblin-7c563e91bf66b0c01dfceb65c614b0da84ed91c3.tar.xz
mediagoblin-7c563e91bf66b0c01dfceb65c614b0da84ed91c3.zip
Attach the MediaGoblinApp to the engine, and provide a way for models to access
This allows SQLAlchemy models to gain access to app-level configuration without the need for global variables. This commit sponsored by Peter Hogg. Thank you, Peter!
Diffstat (limited to 'mediagoblin/db/base.py')
-rw-r--r--mediagoblin/db/base.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/mediagoblin/db/base.py b/mediagoblin/db/base.py
index c3c34763..6acb0b79 100644
--- a/mediagoblin/db/base.py
+++ b/mediagoblin/db/base.py
@@ -30,6 +30,10 @@ class GMGTableBase(object):
def _session(self):
return inspect(self).session
+ @property
+ def _app(self):
+ return self._session.bind.app
+
if not DISABLE_GLOBALS:
query = Session.query_property()