[Zope-CVS] CVS: Products/Ape/lib/apelib/tests - serialtestbase.py:1.8 testio.py:1.8

Shane Hathaway shane at zope.com
Fri Jul 23 04:38:04 EDT 2004


Update of /cvs-repository/Products/Ape/lib/apelib/tests
In directory cvs.zope.org:/tmp/cvs-serv26116/lib/apelib/tests

Modified Files:
	serialtestbase.py testio.py 
Log Message:
Ape now supports mapping subclasses.  Also revised the config format.

>From CHANGES.txt:

  - Ape now supports mapping subclasses.  Until now, mappers were
    registered for classes but not for all subclasses.  Now, a mapper
    applies to subclasses as well, unless the configuration file
    specifies 'exact-class'.

  - Revised the configuration file format for simplification and to
    allow mapping subclasses.

Also added PDBSerializer, a wrapper around CompositeSerializer that 
launches pdb.  It is really handy when you know which 
mapper is serializing incorrectly but you don't know why.



=== Products/Ape/lib/apelib/tests/serialtestbase.py 1.7 => 1.8 ===
--- Products/Ape/lib/apelib/tests/serialtestbase.py:1.7	Wed Jul 21 02:38:05 2004
+++ Products/Ape/lib/apelib/tests/serialtestbase.py	Fri Jul 23 04:37:34 2004
@@ -34,13 +34,12 @@
 def add_mapper(conf, klass, mapper_name):
     """Adds a simple mapper to the configuration.
     """
-    serializer = serializers.CompositeSerializer(
-        klass.__module__, klass.__name__)
+    serializer = serializers.CompositeSerializer()
     gateway = gateways.RAMGateway(serializer.schema)
-    m = mapper.Mapper(serializer, gateway)
     class_name = '%s.%s' % (klass.__module__, klass.__name__)
+    m = mapper.Mapper(mapper_name, class_name, serializer, gateway)
     conf.mappers[mapper_name] = m
-    conf.classifier.register("class", class_name, mapper_name)
+    conf.classifier.add_store_rule(class_name, mapper_name)
     return m
 
 


=== Products/Ape/lib/apelib/tests/testio.py 1.7 => 1.8 ===
--- Products/Ape/lib/apelib/tests/testio.py:1.7	Sat Mar 20 01:34:24 2004
+++ Products/Ape/lib/apelib/tests/testio.py	Fri Jul 23 04:37:34 2004
@@ -64,7 +64,7 @@
         obsys = io.ObjectSystemIO(self.conf, obj_db)
         event, classification, state = obsys.serialize(oid, ob)
 
-        ob2 = obsys.new_instance(classification)
+        ob2 = obsys.new_instance(oid, classification)
         obsys.deserialize(oid, ob2, classification, state)
         self.assertEqual(ob.strdata, ob2.strdata)
         self.assertEqual(ob.data, ob2.data)
@@ -84,7 +84,7 @@
         gwsys.store(oid, classification, state, True)
 
         event, classification, state, hash_value = gwsys.load(oid)
-        ob2 = obsys.new_instance(classification)
+        ob2 = obsys.new_instance(oid, classification)
         obsys.deserialize(oid, ob2, classification, state)
         self.assertEqual(ob.strdata, ob2.strdata)
         self.assertEqual(ob.data, ob2.data)



More information about the Zope-CVS mailing list