[Zodb-checkins] CVS: ZODB/src/ZODB/tests - util.py:1.4 test_cache.py:1.5 testZODB.py:1.29 testRecover.py:1.7 testPersistentMapping.py:1.9 testDB.py:1.7 testConnection.py:1.13 testConfig.py:1.17 testCache.py:1.22 testBroken.py:1.4 speed.py:1.6 dangle.py:1.4 VersionStorage.py:1.32 TransactionalUndoStorage.py:1.42 RecoveryStorage.py:1.14 PackableStorage.py:1.39 MTStorage.py:1.17 BasicStorage.py:1.30

Jeremy Hylton jeremy at zope.com
Fri Apr 16 11:58:44 EDT 2004


Update of /cvs-repository/ZODB/src/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv11088/src/ZODB/tests

Modified Files:
	util.py test_cache.py testZODB.py testRecover.py 
	testPersistentMapping.py testDB.py testConnection.py 
	testConfig.py testCache.py testBroken.py speed.py dangle.py 
	VersionStorage.py TransactionalUndoStorage.py 
	RecoveryStorage.py PackableStorage.py MTStorage.py 
	BasicStorage.py 
Log Message:
Replace use of builtin get_transaction() with explicit transaction module.


=== ZODB/src/ZODB/tests/util.py 1.3 => 1.4 ===
--- ZODB/src/ZODB/tests/util.py:1.3	Thu Feb 19 13:24:00 2004
+++ ZODB/src/ZODB/tests/util.py	Fri Apr 16 11:58:11 2004
@@ -18,6 +18,7 @@
 
 import time
 import persistent
+import transaction
 from ZODB.MappingStorage import MappingStorage
 from ZODB.DB import DB as _DB
 try:
@@ -29,7 +30,7 @@
     return _DB(MappingStorage(name))
 
 def commit():
-    get_transaction().commit()
+    transaction.commit()
 
 def pack(db):
     db.pack(time.time()+1)


=== ZODB/src/ZODB/tests/test_cache.py 1.4 => 1.5 ===
--- ZODB/src/ZODB/tests/test_cache.py:1.4	Thu Mar 11 22:37:56 2004
+++ ZODB/src/ZODB/tests/test_cache.py	Fri Apr 16 11:58:11 2004
@@ -16,6 +16,7 @@
 import doctest
 
 from persistent import Persistent
+import transaction
 from ZODB.config import databaseFromString
 
 class RecalcitrantObject(Persistent):
@@ -67,7 +68,7 @@
         ...     o = RegularObject()
         ...     L.append(o)
         ...     r[i] = o
-        >>> get_transaction().commit()
+        >>> transaction.commit()
 
         After committing a transaction and calling cacheGC(), there
         should be cache-size (4) objects in the cache.  One of the
@@ -137,7 +138,7 @@
         ...     o = RecalcitrantObject()
         ...     L.append(o)
         ...     r[i] = o
-        >>> get_transaction().commit()
+        >>> transaction.commit()
         >>> [o._p_state for o in L]
         [0, 0, 0, 0, 0]
 
@@ -174,7 +175,7 @@
         ...     o = RegularObject()
         ...     L.append(o)
         ...     r[i] = o
-        >>> get_transaction().commit()
+        >>> transaction.commit()
         >>> RegularObject.deactivations
         1
 
@@ -188,7 +189,7 @@
         >>> cn._cache.ringlen()
         5
 
-        >>> get_transaction().abort()
+        >>> transaction.abort()
         >>> cn._cache.ringlen()
         2
         >>> RegularObject.deactivations


=== ZODB/src/ZODB/tests/testZODB.py 1.28 => 1.29 ===
--- ZODB/src/ZODB/tests/testZODB.py:1.28	Fri Apr 16 10:43:41 2004
+++ ZODB/src/ZODB/tests/testZODB.py	Fri Apr 16 11:58:11 2004
@@ -43,14 +43,14 @@
         self._db = ZODB.DB(self._storage)
 
     def populate(self):
-        get_transaction().begin()
+        transaction.begin()
         conn = self._db.open()
         root = conn.root()
         root['test'] = pm = PersistentMapping()
         for n in range(100):
             pm[n] = PersistentMapping({0: 100 - n})
-        get_transaction().note('created test data')
-        get_transaction().commit()
+        transaction.get().note('created test data')
+        transaction.commit()
         conn.close()
 
     def tearDown(self):
@@ -71,8 +71,8 @@
             conn.close()
 
     def duplicate(self, conn, abort_it):
-        get_transaction().begin()
-        get_transaction().note('duplication')
+        transaction.begin()
+        transaction.get().note('duplication')
         root = conn.root()
         ob = root['test']
         assert len(ob) > 10, 'Insufficient test data'
@@ -87,15 +87,15 @@
             root['dup'] = new_ob
             f.close()
             if abort_it:
-                get_transaction().abort()
+                transaction.abort()
             else:
-                get_transaction().commit()
+                transaction.commit()
         except:
-            get_transaction().abort()
+            transaction.abort()
             raise
 
     def verify(self, conn, abort_it):
-        get_transaction().begin()
+        transaction.begin()
         root = conn.root()
         ob = root['test']
         try:
@@ -123,7 +123,7 @@
         for v in ob2.values():
             assert not oids.has_key(v._p_oid), (
                 'Did not fully separate duplicate from original')
-        get_transaction().commit()
+        transaction.commit()
 
     def checkExportImportAborted(self):
         self.checkExportImport(abort_it=True)
@@ -136,11 +136,11 @@
         try:
             r = conn.root()
             r[1] = 1
-            get_transaction().commit()
+            transaction.commit()
         finally:
             conn.close()
         self._db.abortVersion("version")
-        get_transaction().commit()
+        transaction.commit()
 
     def checkResetCache(self):
         # The cache size after a reset should be 0.  Note that
@@ -302,7 +302,7 @@
         real_data["b"] = PersistentMapping({"indexed_value": 1})
         index[1] = PersistentMapping({"b": 1})
         index[0] = PersistentMapping({"a": 1})
-        get_transaction().commit()
+        transaction.commit()
 
         # load some objects from one connection
         tm = transaction.TransactionManager()
@@ -314,7 +314,7 @@
         real_data["b"]["indexed_value"] = 0
         del index[1]["b"]
         index[0]["b"] = 1
-        get_transaction().commit()
+        transaction.commit()
 
         del real_data2["a"]
         try:
@@ -334,7 +334,7 @@
         self.assert_(not index2[1]._p_changed)
 
         self.assertRaises(ConflictError, tm.get().commit)
-        get_transaction().abort()
+        transaction.abort()
 
     def checkIndependent(self):
         self.obj = Independent()


=== ZODB/src/ZODB/tests/testRecover.py 1.6 => 1.7 ===
--- ZODB/src/ZODB/tests/testRecover.py:1.6	Wed Dec 24 11:01:58 2003
+++ ZODB/src/ZODB/tests/testRecover.py	Fri Apr 16 11:58:11 2004
@@ -26,6 +26,7 @@
 from ZODB.fsrecover import recover
 
 from persistent.mapping import PersistentMapping
+import transaction
 
 class RecoverTest(unittest.TestCase):
 
@@ -58,10 +59,10 @@
         # looks like a Data.fs > 1MB
         for i in range(50):
             d = rt[i] = PersistentMapping()
-            get_transaction().commit()
+            transaction.commit()
             for j in range(50):
                 d[j] = "a" * j
-            get_transaction().commit()
+            transaction.commit()
 
     def damage(self, num, size):
         self.storage.close()


=== ZODB/src/ZODB/tests/testPersistentMapping.py 1.8 => 1.9 ===
--- ZODB/src/ZODB/tests/testPersistentMapping.py:1.8	Mon Apr  5 14:48:22 2004
+++ ZODB/src/ZODB/tests/testPersistentMapping.py	Fri Apr 16 11:58:11 2004
@@ -22,9 +22,10 @@
 
 import unittest
 
+import transaction
+from transaction import Transaction
 import ZODB
 from ZODB.MappingStorage import MappingStorage
-from transaction import Transaction
 import cPickle
 import cStringIO
 import sys
@@ -59,7 +60,7 @@
         r[1] = 1
         r[2] = 2
         r[3] = r
-        get_transaction().commit()
+        transaction.commit()
         # MappingStorage stores serialno + pickle in its _index.
         root_pickle = s._index['\000' * 8][8:]
 


=== ZODB/src/ZODB/tests/testDB.py 1.6 => 1.7 ===
--- ZODB/src/ZODB/tests/testDB.py:1.6	Wed Mar  3 09:55:01 2004
+++ ZODB/src/ZODB/tests/testDB.py	Fri Apr 16 11:58:11 2004
@@ -16,6 +16,8 @@
 import unittest
 import warnings
 
+import transaction
+
 import ZODB
 import ZODB.FileStorage
 
@@ -38,10 +40,10 @@
         c = self.db.open(version)
         r = c.root()
         o = r[time.time()] = MinPO(0)
-        get_transaction().commit()
+        transaction.commit()
         for i in range(25):
             o.value = MinPO(i)
-            get_transaction().commit()
+            transaction.commit()
             o = o.value
         c.close()
 


=== ZODB/src/ZODB/tests/testConnection.py 1.12 => 1.13 ===
--- ZODB/src/ZODB/tests/testConnection.py:1.12	Thu Apr 15 21:08:12 2004
+++ ZODB/src/ZODB/tests/testConnection.py	Fri Apr 16 11:58:11 2004
@@ -18,10 +18,10 @@
 import warnings
 
 from persistent import Persistent
+import transaction
 from ZODB.config import databaseFromString
 from ZODB.utils import p64, u64
 from ZODB.tests.warnhook import WarningsHook
-import transaction
 
 class ConnectionDotAdd(unittest.TestCase):
 
@@ -397,7 +397,7 @@
         >>> p3 = Persistent()
         >>> r = cn.root()
         >>> r.update(dict(p1=p1, p2=p2, p3=p3))
-        >>> get_transaction().commit()
+        >>> transaction.commit()
 
         Transaction ids are 8-byte strings, just like oids; p64() will
         create one from an int.


=== ZODB/src/ZODB/tests/testConfig.py 1.16 => 1.17 ===
--- ZODB/src/ZODB/tests/testConfig.py:1.16	Thu Feb 26 19:31:55 2004
+++ ZODB/src/ZODB/tests/testConfig.py	Fri Apr 16 11:58:11 2004
@@ -15,6 +15,7 @@
 import tempfile
 import unittest
 
+import transaction
 import ZODB.config
 from ZODB.POSException import ReadOnlyError
 
@@ -34,7 +35,7 @@
         cn = db.open()
         rt = cn.root()
         rt["test"] = 1
-        get_transaction().commit()
+        transaction.commit()
         db.close()
 
 


=== ZODB/src/ZODB/tests/testCache.py 1.21 => 1.22 ===
--- ZODB/src/ZODB/tests/testCache.py:1.21	Sat Mar 13 02:48:11 2004
+++ ZODB/src/ZODB/tests/testCache.py	Fri Apr 16 11:58:11 2004
@@ -22,10 +22,11 @@
 import time
 import unittest
 
-import ZODB
-import ZODB.MappingStorage
 from persistent.cPickleCache import PickleCache
 from persistent.mapping import PersistentMapping
+import transaction
+import ZODB
+import ZODB.MappingStorage
 from ZODB.tests.MinPO import MinPO
 from ZODB.utils import p64
 
@@ -60,14 +61,14 @@
         d = r.get(i)
         if d is None:
             d = r[i] = PersistentMapping()
-            get_transaction().commit()
+            transaction.commit()
 
         for i in range(15):
             o = d.get(i)
             if o is None:
                 o = d[i] = MinPO(i)
             o.value += 1
-        get_transaction().commit()
+        transaction.commit()
 
 class DBMethods(CacheTestBase):
 
@@ -145,7 +146,7 @@
         for t in range(5):
             for i in range(dataset_size):
                 l[(t,i)] = r[i] = MinPO(i)
-            get_transaction().commit()
+            transaction.commit()
             # commit() will register the objects, placing them in the
             # cache.  at the end of commit, the cache will be reduced
             # down to CACHE_SIZE items


=== ZODB/src/ZODB/tests/testBroken.py 1.3 => 1.4 ===
--- ZODB/src/ZODB/tests/testBroken.py:1.3	Thu Mar  4 17:41:53 2004
+++ ZODB/src/ZODB/tests/testBroken.py	Fri Apr 16 11:58:11 2004
@@ -19,7 +19,7 @@
 import sys
 import unittest
 import persistent
-#from transaction import get_transaction
+import transaction
 from doctest import DocTestSuite
 from ZODB.tests.util import DB
 
@@ -46,7 +46,7 @@
     >>> a.x = 1
     >>> conn1 = db.open()
     >>> conn1.root()['a'] = a
-    >>> get_transaction().commit()
+    >>> transaction.commit()
 
     >>> conn2 = db.open()
     >>> a2 = conn2.root()['a']


=== ZODB/src/ZODB/tests/speed.py 1.5 => 1.6 ===
--- ZODB/src/ZODB/tests/speed.py:1.5	Fri Nov 28 11:44:54 2003
+++ ZODB/src/ZODB/tests/speed.py	Fri Apr 16 11:58:11 2004
@@ -40,6 +40,7 @@
 
 import ZODB, ZODB.FileStorage
 import persistent
+import transaction
 
 class P(persistent.Persistent): pass
 
@@ -85,7 +86,7 @@
         for r in 1, 10, 100, 1000:
             t=time.time()
             jar=db.open()
-            get_transaction().begin()
+            transaction.begin()
             rt=jar.root()
             key='s%s' % r
             if rt.has_key(key): p=rt[key]
@@ -96,7 +97,7 @@
                 v=getattr(p, str(i), P())
                 v.d=d
                 setattr(p,str(i),v)
-            get_transaction().commit()
+            transaction.commit()
             jar.close()
             t=time.time()-t
             if detailed:


=== ZODB/src/ZODB/tests/dangle.py 1.3 => 1.4 ===
--- ZODB/src/ZODB/tests/dangle.py:1.3	Fri Nov 28 11:44:54 2003
+++ ZODB/src/ZODB/tests/dangle.py	Fri Apr 16 11:58:11 2004
@@ -18,6 +18,7 @@
 
 import time
 
+import transaction
 from ZODB.FileStorage import FileStorage
 from ZODB import DB
 
@@ -30,20 +31,20 @@
     rt = db.open().root()
 
     rt[1] = o1 = P()
-    get_transaction().note("create o1")
-    get_transaction().commit()
+    transaction.get().note("create o1")
+    transaction.commit()
 
     rt[2] = o2 = P()
-    get_transaction().note("create o2")
-    get_transaction().commit()
+    transaction.get().note("create o2")
+    transaction.commit()
 
     c = o1.child = P()
-    get_transaction().note("set child on o1")
-    get_transaction().commit()
+    transaction.get().note("set child on o1")
+    transaction.commit()
 
     o1.child = P()
-    get_transaction().note("replace child on o1")
-    get_transaction().commit()
+    transaction.get().note("replace child on o1")
+    transaction.commit()
 
     time.sleep(2)
     # The pack should remove the reference to c, because it is no
@@ -53,8 +54,8 @@
 
     print repr(c._p_oid)
     o2.child = c
-    get_transaction().note("set child on o2")
-    get_transaction().commit()
+    transaction.get().note("set child on o2")
+    transaction.commit()
 
 def main():
     fs = FileStorage("dangle.fs")


=== ZODB/src/ZODB/tests/VersionStorage.py 1.31 => 1.32 ===
--- ZODB/src/ZODB/tests/VersionStorage.py:1.31	Wed Mar 31 22:56:57 2004
+++ ZODB/src/ZODB/tests/VersionStorage.py	Fri Apr 16 11:58:11 2004
@@ -18,6 +18,7 @@
 
 import time
 
+import transaction
 from transaction import Transaction
 
 from ZODB import POSException
@@ -394,12 +395,12 @@
 
         obj = root["obj"] = MinPO("obj")
         root["obj2"] = MinPO("obj2")
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note("create 2 objs in version")
         txn.commit()
 
         obj.value = "77"
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note("modify obj in version")
         txn.commit()
 
@@ -407,7 +408,7 @@
         # and versions for pack to chase
         info = db.undoInfo()
         db.undo(info[0]["id"])
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note("undo modification")
         txn.commit()
 
@@ -415,7 +416,7 @@
         self._storage.pack(time.time(), referencesf)
 
         db.commitVersion("testversion")
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note("commit version")
         txn.commit()
 
@@ -423,7 +424,7 @@
         root = cn.root()
         root["obj"] = "no version"
 
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note("modify obj")
         txn.commit()
 
@@ -436,12 +437,12 @@
 
         obj = root["obj"] = MinPO("obj")
         root["obj2"] = MinPO("obj2")
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note("create 2 objs in version")
         txn.commit()
 
         obj.value = "77"
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note("modify obj in version")
         txn.commit()
 
@@ -452,14 +453,14 @@
         # and versions for pack to chase
         info = db.undoInfo()
         db.undo(info[0]["id"])
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note("undo modification")
         txn.commit()
 
         self._storage.pack(t0, referencesf)
 
         db.commitVersion("testversion")
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note("commit version")
         txn.commit()
 
@@ -467,7 +468,7 @@
         root = cn.root()
         root["obj"] = "no version"
 
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note("modify obj")
         txn.commit()
 
@@ -482,18 +483,18 @@
 
         for name in names:
             root[name] = MinPO(name)
-            get_transaction().commit()
+            transaction.commit()
 
         for name in names:
             cn2 = db.open(version=name)
             rt2 = cn2.root()
             obj = rt2[name]
             obj.value = MinPO("version")
-            get_transaction().commit()
+            transaction.commit()
             cn2.close()
 
         root["d"] = MinPO("d")
-        get_transaction().commit()
+        transaction.commit()
         snooze()
 
         self._storage.pack(time.time(), referencesf)
@@ -511,11 +512,11 @@
             obj = rt2[name].value
             self.assertEqual(obj.value, "version")
             obj.value = "still version"
-            get_transaction().commit()
+            transaction.commit()
             cn2.close()
 
         db.abortVersion("b")
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note("abort version b")
         txn.commit()
 
@@ -524,7 +525,7 @@
 
         L = db.undoInfo()
         db.undo(L[0]["id"])
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note("undo abort")
         txn.commit()
 


=== ZODB/src/ZODB/tests/TransactionalUndoStorage.py 1.41 => 1.42 ===
--- ZODB/src/ZODB/tests/TransactionalUndoStorage.py:1.41	Wed Mar 31 22:56:57 2004
+++ ZODB/src/ZODB/tests/TransactionalUndoStorage.py	Fri Apr 16 11:58:11 2004
@@ -20,6 +20,7 @@
 import types
 
 from persistent import Persistent
+import transaction
 from transaction import Transaction
 
 from ZODB import POSException
@@ -468,7 +469,7 @@
         o2 = C()
         root['obj'] = o1
         o1.obj = o2
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note('o1 -> o2')
         txn.commit()
         now = packtime = time.time()
@@ -477,12 +478,12 @@
 
         o3 = C()
         o2.obj = o3
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note('o1 -> o2 -> o3')
         txn.commit()
 
         o1.obj = o3
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note('o1 -> o3')
         txn.commit()
 
@@ -500,7 +501,7 @@
 
         tid = log[0]['id']
         db.undo(tid)
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note('undo')
         txn.commit()
         # undo does a txn-undo, but doesn't invalidate
@@ -527,14 +528,14 @@
         root["key0"] = MinPO(0)
         root["key1"] = MinPO(1)
         root["key2"] = MinPO(2)
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note("create 3 keys")
         txn.commit()
 
         set_pack_time()
 
         del root["key1"]
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note("delete 1 key")
         txn.commit()
 
@@ -546,7 +547,7 @@
 
         L = db.undoInfo()
         db.undo(L[0]["id"])
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note("undo deletion")
         txn.commit()
 
@@ -574,11 +575,11 @@
         rt = cn.root()
 
         rt["test"] = MinPO(1)
-        get_transaction().commit()
+        transaction.commit()
         rt["test2"] = MinPO(2)
-        get_transaction().commit()
+        transaction.commit()
         rt["test"] = MinPO(3)
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note("root of undo")
         txn.commit()
 
@@ -586,7 +587,7 @@
         for i in range(10):
             L = db.undoInfo()
             db.undo(L[0]["id"])
-            txn = get_transaction()
+            txn = transaction.get()
             txn.note("undo %d" % i)
             txn.commit()
             rt._p_deactivate()
@@ -706,7 +707,7 @@
 
     def checkUndoLogMetadata(self):
         # test that the metadata is correct in the undo log
-        t = get_transaction()
+        t = transaction.get()
         t.note('t1')
         t.setExtendedInfo('k2','this is transaction metadata')
         t.setUser('u3',path='p3')
@@ -715,7 +716,7 @@
         root = conn.root()
         o1 = C()
         root['obj'] = o1
-        txn = get_transaction()
+        txn = transaction.get()
         txn.commit()
         l = self._storage.undoLog()
         self.assertEqual(len(l),2)


=== ZODB/src/ZODB/tests/RecoveryStorage.py 1.13 => 1.14 ===
--- ZODB/src/ZODB/tests/RecoveryStorage.py:1.13	Wed Mar 31 22:56:57 2004
+++ ZODB/src/ZODB/tests/RecoveryStorage.py	Fri Apr 16 11:58:11 2004
@@ -13,6 +13,7 @@
 ##############################################################################
 """More recovery and iterator tests."""
 
+import transaction
 from transaction import Transaction
 from ZODB.tests.IteratorStorage import IteratorDeepCompare
 from ZODB.tests.StorageTestBase import MinPO, zodb_unpickle, snooze
@@ -134,9 +135,9 @@
         c = db.open()
         r = c.root()
         obj = r["obj1"] = MinPO(1)
-        get_transaction().commit()
+        transaction.commit()
         obj = r["obj2"] = MinPO(1)
-        get_transaction().commit()
+        transaction.commit()
 
         self._dst.copyTransactionsFrom(self._storage)
         self._dst.pack(time.time(), referencesf)
@@ -161,15 +162,15 @@
         conn = db.open()
         root = conn.root()
         root.obj = obj1 = MinPO(1)
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note('root -> obj')
         txn.commit()
         root.obj.obj = obj2 = MinPO(2)
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note('root -> obj -> obj')
         txn.commit()
         del root.obj
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note('root -X->')
         txn.commit()
         # Now copy the transactions to the destination


=== ZODB/src/ZODB/tests/PackableStorage.py 1.38 => 1.39 ===
--- ZODB/src/ZODB/tests/PackableStorage.py:1.38	Wed Mar 31 22:56:57 2004
+++ ZODB/src/ZODB/tests/PackableStorage.py	Fri Apr 16 11:58:11 2004
@@ -27,9 +27,10 @@
 
 import time
 
-from ZODB import DB
 from persistent import Persistent
 from persistent.mapping import PersistentMapping
+import transaction
+from ZODB import DB
 from ZODB.serialize import referencesf
 from ZODB.tests.MinPO import MinPO
 from ZODB.tests.StorageTestBase import snooze
@@ -164,7 +165,7 @@
 
         for i in range(10):
             root[i] = MinPO(i)
-        get_transaction().commit()
+        transaction.commit()
 
         snooze()
         packt = time.time()
@@ -173,7 +174,7 @@
         for dummy in choices:
             for i in choices:
                 root[i].value = MinPO(i)
-                get_transaction().commit()
+                transaction.commit()
 
         # How many client threads should we run, and how long should we
         # wait for them to finish?  Hard to say.  Running 4 threads and
@@ -274,7 +275,7 @@
         choices = range(10)
         for i in choices:
             root[i] = MinPO(i)
-        get_transaction().commit()
+        transaction.commit()
 
         snooze()
         packt = time.time()
@@ -282,7 +283,7 @@
         for dummy in choices:
            for i in choices:
                root[i].value = MinPO(i)
-               get_transaction().commit()
+               transaction.commit()
 
         NUM_LOOP_TRIP = 100
         timer = ElapsedTimer(time.time())
@@ -500,7 +501,7 @@
         conn = db.open()
         root = conn.root()
 
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note('root')
         txn.commit()
 
@@ -512,12 +513,12 @@
         obj.value = 7
 
         root['obj'] = obj
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note('root -> o1')
         txn.commit()
 
         del root['obj']
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note('root -x-> o1')
         txn.commit()
 
@@ -526,7 +527,7 @@
         log = self._storage.undoLog()
         tid = log[0]['id']
         db.undo(tid)
-        txn = get_transaction()
+        txn = transaction.get()
         txn.note('undo root -x-> o1')
         txn.commit()
 
@@ -552,19 +553,19 @@
         root = conn.root()
 
         root["d"] = d = PersistentMapping()
-        get_transaction().commit()
+        transaction.commit()
         snooze()
 
         obj = d["obj"] = C()
         obj.value = 1
-        get_transaction().commit()
+        transaction.commit()
         snooze()
         packt1 = time.time()
         lost_oid = obj._p_oid
 
         obj = d["anotherobj"] = C()
         obj.value = 2
-        get_transaction().commit()
+        transaction.commit()
         snooze()
         packt2 = time.time()
 
@@ -682,13 +683,13 @@
                 alist.extend([self.millis(), index])
                 self.root[index].value = MinPO(j)
                 assign_worked = True
-                get_transaction().commit()
+                transaction.commit()
                 alist.append(self.millis())
                 alist.append('OK')
             except ConflictError:
                 alist.append(self.millis())
                 alist.append('Conflict')
-                get_transaction().abort()
+                transaction.abort()
             alist.append(assign_worked)
 
 class ElapsedTimer:


=== ZODB/src/ZODB/tests/MTStorage.py 1.16 => 1.17 ===
--- ZODB/src/ZODB/tests/MTStorage.py:1.16	Wed Mar 31 22:56:57 2004
+++ ZODB/src/ZODB/tests/MTStorage.py	Fri Apr 16 11:58:11 2004
@@ -72,7 +72,7 @@
     def commit(self, d, num):
         d[num] = time.time()
         time.sleep(self.delay)
-        get_transaction().commit()
+        transaction.commit()
         time.sleep(self.delay)
 
     def get_thread_dict(self, root):
@@ -82,16 +82,16 @@
             try:
                 m = PersistentMapping()
                 root[name] = m
-                get_transaction().commit()
+                transaction.commit()
                 break
             except ConflictError, err:
-                get_transaction().abort()
+                transaction.abort()
                 root._p_jar.sync()
         for i in range(10):
             try:
                 return root.get(name)
             except ConflictError:
-                get_transaction().abort()
+                transaction.abort()
 
 class StorageClientThread(TestThread):
 


=== ZODB/src/ZODB/tests/BasicStorage.py 1.29 => 1.30 ===
--- ZODB/src/ZODB/tests/BasicStorage.py:1.29	Wed Mar 31 22:56:57 2004
+++ ZODB/src/ZODB/tests/BasicStorage.py	Fri Apr 16 11:58:11 2004
@@ -55,7 +55,8 @@
             assert 0, "Should have failed, invalid transaction."
 
         try:
-            self._storage.commitVersion('dummy', 'dummer', transaction.Transaction())
+            self._storage.commitVersion('dummy', 'dummer',
+                                        transaction.Transaction())
         except (POSException.StorageTransactionError,
                 POSException.VersionCommitError):
             pass # test passed ;)




More information about the Zodb-checkins mailing list