[Checkins] SVN: z3c.zalchemy/trunk/ added note about the threadlocal change

Christian Zagrodnick cz at gocept.com
Wed Sep 5 15:15:55 EDT 2007


Log message for revision 79485:
  added note about the threadlocal change
  
  fixed a bug in _resetEngine which was not deleting the engine correctly

Changed:
  U   z3c.zalchemy/trunk/CHANGES.txt
  U   z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py
  U   z3c.zalchemy/trunk/src/z3c/zalchemy/tests/test_zalchemy.py

-=-
Modified: z3c.zalchemy/trunk/CHANGES.txt
===================================================================
--- z3c.zalchemy/trunk/CHANGES.txt	2007-09-05 16:33:05 UTC (rev 79484)
+++ z3c.zalchemy/trunk/CHANGES.txt	2007-09-05 19:15:54 UTC (rev 79485)
@@ -5,6 +5,9 @@
 0.2 - unreleased
 ================
 
+  - Using the threadlocal strategy of sqlalchemy instead of doing that
+    ourselves.
+
   - Added support for optimistic savepoints. This can be used, similarly to
     what happens with ZODB, to flush intermediary work without committing.
 

Modified: z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py
===================================================================
--- z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py	2007-09-05 16:33:05 UTC (rev 79484)
+++ z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py	2007-09-05 19:15:54 UTC (rev 79485)
@@ -61,7 +61,7 @@
         engine = getattr(self, '_v_engine', None)
         if engine is not None:
             engine.dispose()
-            self.engine = None
+            self._v_engine = None
 
 
 for name in IAlchemyEngineUtility:

Modified: z3c.zalchemy/trunk/src/z3c/zalchemy/tests/test_zalchemy.py
===================================================================
--- z3c.zalchemy/trunk/src/z3c/zalchemy/tests/test_zalchemy.py	2007-09-05 16:33:05 UTC (rev 79484)
+++ z3c.zalchemy/trunk/src/z3c/zalchemy/tests/test_zalchemy.py	2007-09-05 19:15:54 UTC (rev 79485)
@@ -72,7 +72,16 @@
         self.assertNotEqual(session, None)
         self.assertNotEqual(session.get_bind(None), None)
 
+    def testResetEngine(self):
+        engineUtility = z3c.zalchemy.datamanager.AlchemyEngineUtility(
+                'database',
+                'sqlite:///:memory:')
+        engine = engineUtility.getEngine()
+        self.assertEquals(engine, engineUtility._v_engine)
+        engineUtility._resetEngine()
+        self.assert_(engineUtility._v_engine is None)
 
+
 def test_suite():
     return unittest.TestSuite((
         DocFileSuite('TRANSACTION.txt',



More information about the Checkins mailing list