Pārlūkot izejas kodu

fix #52 sqlalchemy webdav issue

Guénaël Muller 6 gadus atpakaļ
vecāks
revīzija
f7ec425c59

+ 1 - 1
tracim/lib/webdav/__init__.py Parādīt failu

75
             WsgiDavDirBrowser,
75
             WsgiDavDirBrowser,
76
             TracimUserSession,
76
             TracimUserSession,
77
             HTTPAuthenticator,
77
             HTTPAuthenticator,
78
-            TracimEnv,
79
             ErrorPrinter,
78
             ErrorPrinter,
80
             TracimWsgiDavDebugFilter,
79
             TracimWsgiDavDebugFilter,
80
+            TracimEnv,
81
 
81
 
82
         ]
82
         ]
83
         config['provider_mapping'] = {
83
         config['provider_mapping'] = {

+ 12 - 1
tracim/models/__init__.py Parādīt failu

48
 
48
 
49
     """
49
     """
50
     dbsession = session_factory()
50
     dbsession = session_factory()
51
+    # FIXME - G.M - 02-05-2018 - Check Zope/Sqlalchemy session conf.
52
+    # We use both keep_session=True for zope and
53
+    # expire_on_commit=False for sessionmaker to keep session alive after
54
+    # commit ( in order  to not have trouble like #52 or
55
+    # detached objects problems).
56
+    # These problem happened because we use "commit" in our current code.
57
+    # Understand what those params really mean and check if it can cause
58
+    # troubles somewhere else.
51
     zope.sqlalchemy.register(
59
     zope.sqlalchemy.register(
52
-        dbsession, transaction_manager=transaction_manager)
60
+        dbsession,
61
+        transaction_manager=transaction_manager,
62
+        keep_session=True,
63
+    )
53
     listen(dbsession, 'before_flush', prevent_content_revision_delete)
64
     listen(dbsession, 'before_flush', prevent_content_revision_delete)
54
     return dbsession
65
     return dbsession
55
 
66
 

+ 0 - 4
tracim/tests/library/test_webdav.py Parādīt failu

311
             )
311
             )
312
         )
312
         )
313
 
313
 
314
-    @pytest.mark.xfail(raises=InvalidRequestError,
315
-                       reason='Sqlalchemy session and transaction bug')
316
     def test_unit__create_delete_and_create_file__ok(self):
314
     def test_unit__create_delete_and_create_file__ok(self):
317
         provider = self._get_provider(self.app_config)
315
         provider = self._get_provider(self.app_config)
318
         environ = self._get_environ(
316
         environ = self._get_environ(
559
                 content_to_move.parent.label
557
                 content_to_move.parent.label
560
         )
558
         )
561
 
559
 
562
-    @pytest.mark.xfail(raises=InvalidRequestError,
563
-                       reason='Sqlalchemy session and transaction bug')
564
     def test_unit__update_content__ok(self):
560
     def test_unit__update_content__ok(self):
565
         provider = self._get_provider(self.app_config)
561
         provider = self._get_provider(self.app_config)
566
         environ = self._get_environ(
562
         environ = self._get_environ(