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