Merge "Add query property to the BASE database model class for convenience"

This commit is contained in:
Jenkins
2014-03-11 23:24:00 +00:00
committed by Gerrit Code Review

View File

@@ -30,6 +30,8 @@ SESSION.configure(bind=ENGINE)
SCOPED_SESSION = scoped_session(SESSION)
SESSION_HOLDER = local()
model.BASE.query = SCOPED_SESSION.query_property()
def init(database_url):
"""Initialize database.
@@ -41,6 +43,7 @@ def init(database_url):
ENGINE = create_engine(database_url, convert_unicode=True)
SESSION.configure(bind=ENGINE)
SCOPED_SESSION = scoped_session(SESSION)
model.BASE.query = SCOPED_SESSION.query_property()
def in_session():