Setting global

This commit is contained in:
Ruud
2011-02-23 14:47:21 +01:00
parent cdde98653e
commit 261f6be7e1
5 changed files with 31 additions and 11 deletions
+4 -2
View File
@@ -16,12 +16,14 @@ app = Flask(__name__)
log = CPLog(__name__)
web = Module(__name__, 'web')
def get_session(engine):
engine = engine if engine else get_engine()
return scoped_session(sessionmaker(autoflush = True, transactional = True, bind = engine))
return scoped_session(sessionmaker(transactional = True, bind = engine))
def get_engine():
return create_engine('sqlite:///' + Env.get('db_path'), echo = Env.get('debug'))
return create_engine('sqlite:///' + Env.get('db_path'), echo = False)
@web.route('/')
@requires_auth