|
@@ -263,13 +263,17 @@ class TracimEnv(BaseMiddleware):
|
263
|
263
|
self.app_config.configure_filedepot()
|
264
|
264
|
|
265
|
265
|
def __call__(self, environ, start_response):
|
266
|
|
- with transaction.manager as tm:
|
267
|
|
- dbsession = get_tm_session(self.session_factory, transaction.manager)
|
268
|
|
- environ['tracim_tm'] = tm
|
269
|
|
- environ['tracim_dbsession'] = dbsession
|
270
|
|
- environ['tracim_cfg'] = self.app_config
|
271
|
|
-
|
272
|
|
- return self._application(environ, start_response)
|
|
266
|
+ # TODO - G.M - 18-05-2018 - This code should not create trouble
|
|
267
|
+ # with thread and database, this should be verify.
|
|
268
|
+ # see https://github.com/tracim/tracim_backend/issues/62
|
|
269
|
+ tm = transaction.manager
|
|
270
|
+ dbsession = get_tm_session(self.session_factory, tm)
|
|
271
|
+ environ['tracim_tm'] = tm
|
|
272
|
+ environ['tracim_dbsession'] = dbsession
|
|
273
|
+ environ['tracim_cfg'] = self.app_config
|
|
274
|
+ app = self._application(environ, start_response)
|
|
275
|
+ dbsession.close()
|
|
276
|
+ return app
|
273
|
277
|
|
274
|
278
|
|
275
|
279
|
class TracimUserSession(BaseMiddleware):
|
|
@@ -285,4 +289,4 @@ class TracimUserSession(BaseMiddleware):
|
285
|
289
|
session=environ['tracim_dbsession'],
|
286
|
290
|
config=environ['tracim_cfg'],
|
287
|
291
|
).get_one_by_email(environ['http_authenticator.username'])
|
288
|
|
- return self._application(environ, start_response)
|
|
292
|
+ return self._application(environ, start_response)
|