[Zope-CVS] CVS: Products/AdaptableStorage/serial - SerializationEvent.py:1.2

Shane Hathaway shane@zope.com
Wed, 4 Dec 2002 23:18:38 -0500


Update of /cvs-repository/Products/AdaptableStorage/serial
In directory cvs.zope.org:/tmp/cvs-serv26322/serial

Modified Files:
	SerializationEvent.py 
Log Message:
- Switched to use of the "remaining state" aspect, enabling storage of
any extra data found on ZODB objects.  Fixed bugs related to this.

- Made sure Zope 2 objects store their classification.

- Modified the serialization event interface a little to allow more
control over automatic references.  This needs work still.

- MetaTypeClassifier is now also an IAspectSerializer, making it
possible to delegate classification details to the classifier.



=== Products/AdaptableStorage/serial/SerializationEvent.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/serial/SerializationEvent.py:1.1	Wed Nov 27 13:37:06 2002
+++ Products/AdaptableStorage/serial/SerializationEvent.py	Wed Dec  4 23:18:08 2002
@@ -44,7 +44,7 @@
 
     # ISerializationEvent interface methods:
 
-    def notifySerialized(self, name, value, attribute=0):
+    def notifySerialized(self, name, value, is_attribute):
         """See the ISerializationEvent interface."""
         assert self._aspect_name is not None
         if (value is not None and value != () and not isinstance(
@@ -54,24 +54,29 @@
             if not self._internal_refs.has_key(idx):
                 self._internal_ref_list.append(value)
                 self._internal_refs[idx] = (self._aspect_name, name)
-        if attribute:
+        if is_attribute:
             self._attrs[name] = 1
 
+    def identifyObject(self, value):
+        kos = self.getKeyedObjectSystem()
+        return kos.identifyObject(value)
+
     def classifyObject(self, value):
-        """See the ISerializationEvent interface."""
         c = self.getObjectMapper().getClassifier()
         return c.classifyObject(value)
 
-    def notifySerializedRef(self, name, value, attribute=0,
-                            mapper_name=None, key=None, stored_key=0):
+    def makeKey(self, mapper_name, name, stored_key=0):
+        dm = self.getObjectMapper().getDomainMapper()
+        sub_mapper = dm.getMapper(mapper_name)
+        key = sub_mapper.getGateway().makeKey(self, name, stored_key)
+        return key
+        
+    def notifySerializedRef(self, name, value, is_attribute,
+                            mapper_name, key):
         assert mapper_name is not None
-        if key is None:
-            dm = self.getObjectMapper().getDomainMapper()
-            sub_mapper = dm.getMapper(mapper_name)
-            key = sub_mapper.getGateway().makeKey(self, name, stored_key)
-            assert key is not None
+        assert key is not None
         self._refs.append((mapper_name, key, value))
-        self.notifySerialized(name, value, attribute)
+        self.notifySerialized(name, value, is_attribute)
 
     def ignoreAttribute(self, name):
         """See the ISerializationEvent interface."""