[Zodb-checkins] CVS: Zope2/lib/python/ZODB - PackableStorage.py:1.2

barry@digicool.com barry@digicool.com
Thu, 19 Apr 2001 16:49:24 -0400 (EDT)


Update of /cvs-repository/Zope2/lib/python/ZODB/tests
In directory korak:/tmp/cvs-serv30385

Modified Files:
	PackableStorage.py 
Log Message:
checkOldRevisionPacked(): Use _dostoreNP(): to avoid the double
pickling



--- Updated File PackableStorage.py in package Zope2/lib/python/ZODB --
--- PackableStorage.py	2001/04/19 20:38:35	1.1
+++ PackableStorage.py	2001/04/19 20:49:24	1.2
@@ -36,11 +36,6 @@
         self._cache[obj.getoid()] = obj
         return obj
 
-    # Override StorageTestBase's method, since we're generating the pickles
-    # in this class explicitly.
-    def _massagedata(self, data):
-        return data
-
     def checkOldRevisionPacked(self):
         # The initial revision has an object graph like so:
         # o1 -> o2 -> o3
@@ -60,16 +55,17 @@
             return s.getvalue()
         p1, p2, p3 = map(dumps, (o1, o2, o3))
         # Now commit these objects
-        revid1 = self._dostore(oid=o1.getoid(), data=p1)
-        revid2 = self._dostore(oid=o2.getoid(), data=p2)
-        revid3 = self._dostore(oid=o3.getoid(), data=p3)
+        revid1 = self._dostoreNP(oid=o1.getoid(), data=p1)
+        revid2 = self._dostoreNP(oid=o2.getoid(), data=p2)
+        revid3 = self._dostoreNP(oid=o3.getoid(), data=p3)
         # Record this moment in history so we can pack everything before it
         t0 = time.time()
         # Now change the object graph to look like so:
         # o1 -> o3
         # and note that o2 is no longer referenced
         o1.object = o3
-        revid11 = self._dostore(oid=o1.getoid(), revid=revid1, data=dumps(o1))
+        p11 = dumps(o1)
+        revid11 = self._dostoreNP(oid=o1.getoid(), revid=revid1, data=p11)
         # Pack away transaction 2
         self._storage.pack(t0, referencesf)
         # Now, objects 1 and 3 should exist, but object 2 should have been
@@ -83,11 +79,11 @@
         data, revid = self._storage.load(o1.getoid(), '')
         assert revid == revid11
         from ZODB import utils
-        assert loads(loads(data)).getoid() == o1.getoid()
+        assert loads(data).getoid() == o1.getoid()
         # Get object 3
         data, revid = self._storage.load(o3.getoid(), '')
         assert revid == revid2
-        assert loads(loads(data)).getoid() == o3.getoid()
+        assert loads(data).getoid() == o3.getoid()
         # Object 2 should fail
         self.assertRaises(KeyError,
                           self._storage.load, o2.getoid(), '')