Browse Source

turbogears: Close db_session for each request

INADA Naoki 10 years ago
parent
commit
29d704f428
1 changed files with 7 additions and 1 deletions
  1. 7 1
      frameworks/Python/turbogears/app.py

+ 7 - 1
frameworks/Python/turbogears/app.py

@@ -84,5 +84,11 @@ class RootController(TGController):
 config = AppConfig(minimal=True, root_controller=RootController())
 config = AppConfig(minimal=True, root_controller=RootController())
 config.renderers.append("jinja")
 config.renderers.append("jinja")
 
 
-app = config.make_wsgi_app()
+tg_app = config.make_wsgi_app()
 
 
+
+def app(env, start):
+    try:
+        return tg_app(env, start)
+    finally:
+        db_session.close()