[Zope-CVS] CVS: Products/Ape/lib/apelib/tests -
serialtestbase.py:1.5 testzope2fs.py:1.6
Shane Hathaway
shane at zope.com
Thu Feb 19 01:44:36 EST 2004
Update of /cvs-repository/Products/Ape/lib/apelib/tests
In directory cvs.zope.org:/tmp/cvs-serv14876/lib/apelib/tests
Modified Files:
serialtestbase.py testzope2fs.py
Log Message:
Two changes that make storing the Zope root object reasonable:
- Pickled remainders are now encoded in base64 and stored in the
properties file. Ape no longer creates .remainder files, although
it will read them. This reduces the number of files Ape creates
and sets a precedent that any annotation can contain a pickle
as long as it's encoded as text.
- There is now one PersistentMappingSerializer. It stores both
references and simple objects. To accomplish this, it has to
store reference values differently from non-reference values.
The non-references get pickled and stored in an annotation called
"other".
In testing, Ape successfully acted as the main Zope
database. Woohoo! (A little Zope hack was required, but it
should be possible to fix that.)
=== Products/Ape/lib/apelib/tests/serialtestbase.py 1.4 => 1.5 ===
--- Products/Ape/lib/apelib/tests/serialtestbase.py:1.4 Mon Feb 2 10:07:22 2004
+++ Products/Ape/lib/apelib/tests/serialtestbase.py Thu Feb 19 01:44:05 2004
@@ -23,7 +23,7 @@
from apelib.core import classifiers, gateways
from apelib.core import mapper, oidgen, schemas, serializers
-from apelib.zodb3.serializers import StringToPersistentPM, StringToPicklePM
+from apelib.zodb3.serializers import PersistentMappingSerializer
from apelib.zodb3.serializers import RemainingState, RollCall
@@ -53,12 +53,12 @@
self.conf = mapper.MapperConfiguration({}, cfr, oid_gen)
m = addMapper(self.conf, PersistentMapping, "pm")
- m.serializer.add("items", StringToPersistentPM())
+ m.serializer.add("items", PersistentMappingSerializer())
m.serializer.add("rollcall", RollCall())
m.gateway.schema = m.serializer.schema
m = addMapper(self.conf, TestObject, "tm")
- m.serializer.add("items", StringToPicklePM())
+ m.serializer.add("items", PersistentMappingSerializer())
m.serializer.add("remainder", RemainingState())
m.gateway.schema = m.serializer.schema
=== Products/Ape/lib/apelib/tests/testzope2fs.py 1.5 => 1.6 ===
--- Products/Ape/lib/apelib/tests/testzope2fs.py:1.5 Mon Feb 2 10:07:22 2004
+++ Products/Ape/lib/apelib/tests/testzope2fs.py Thu Feb 19 01:44:05 2004
@@ -541,7 +541,7 @@
def testRemainderStorage(self):
- # Verify that FSConnection puts the remainder in a separate file
+ # Verify that FSConnection puts the remainder in the properties file
conn = self.db.open()
try:
content = 'tacked_on_data'
@@ -557,13 +557,14 @@
finally:
conn2.close()
- # Verify the stowaway is in the remainder file.
+ # Verify the stowaway is in the properties file.
dir = self.conn.getPath('/')
- f = open(os.path.join(dir, self.conn.afs.annotation_prefix
- + 'remainder'), 'rb')
+ p = os.path.join(
+ dir, self.conn.afs.annotation_prefix + 'properties')
+ f = open(p, 'rt')
data = f.read()
f.close()
- self.assert_(data.find(content) >= 0)
+ self.assert_(data.find('_stowaway') >= 0)
finally:
conn.close()
More information about the Zope-CVS
mailing list