[Zope-CVS] CVS: Products/AdaptableStorage/mapper/interfaces - IAspectSerializer.py:1.2 IObjectSerializer.py:1.2
Shane Hathaway
shane@zope.com
Mon, 6 Jan 2003 10:37:18 -0500
Update of /cvs-repository/Products/AdaptableStorage/mapper/interfaces
In directory cvs.zope.org:/tmp/cvs-serv31552/mapper/interfaces
Modified Files:
IAspectSerializer.py IObjectSerializer.py
Log Message:
Added OptionalAspect, a wrapper that disables an aspect if it can't
serialize the object. This involved refactoring the IAspectSerializer
and IObjectSerializer interfaces. Thanks, Christian, for discovering
the need for this.
=== Products/AdaptableStorage/mapper/interfaces/IAspectSerializer.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/mapper/interfaces/IAspectSerializer.py:1.1 Tue Dec 31 16:47:46 2002
+++ Products/AdaptableStorage/mapper/interfaces/IAspectSerializer.py Mon Jan 6 10:36:46 2003
@@ -25,6 +25,10 @@
"""Returns the schema of records (de)serialized by this aspect.
"""
+ def canSerialize(object):
+ """Returns true if this serializer can serialize the given object.
+ """
+
def serialize(object, event):
"""Returns the state of this aspect of the object.
=== Products/AdaptableStorage/mapper/interfaces/IObjectSerializer.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/mapper/interfaces/IObjectSerializer.py:1.1 Tue Dec 31 16:47:46 2002
+++ Products/AdaptableStorage/mapper/interfaces/IObjectSerializer.py Mon Jan 6 10:36:46 2003
@@ -16,37 +16,15 @@
$Id$
"""
-from Interface import Interface
+from IAspectSerializer import IAspectSerializer
-class IObjectSerializer(Interface):
+class IObjectSerializer(IAspectSerializer):
"""Serializes/deserializes objects.
The serialized state does not need to include the class of the object,
which is maintained separately.
"""
-
- def getSchema():
- """Returns the schema of states (de)serialized by this object.
- """
-
- def canSerialize(object):
- """Returns true if this mapper can serialize the given object.
- """
-
- def serialize(object, event):
- """Returns the serialization of an object.
-
- Returns a pair containing the serialized state of the object
- and a list of externally referenced objects of the form
- (keychain, object). The serialized state should be a
- dictionary mapping aspect names to the serialization of the
- corresponding aspects.
- """
-
- def deserialize(object, event, full_state):
- """Fills an object based on a previously serialized state.
- """
def createEmptyInstance(classification=None):
"""Returns a new instance.