[Zope-CVS] CVS: Products/AdaptableStorage/mapper - SerializationEvent.py:1.2
Shane Hathaway
shane@zope.com
Mon, 6 Jan 2003 09:55:43 -0500
Update of /cvs-repository/Products/AdaptableStorage/mapper
In directory cvs.zope.org:/tmp/cvs-serv24827/mapper
Modified Files:
SerializationEvent.py
Log Message:
Fixed loading and storage of binary data. Thanks, Christian Zagrodnick.
=== Products/AdaptableStorage/mapper/SerializationEvent.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/mapper/SerializationEvent.py:1.1 Tue Dec 31 16:47:46 2002
+++ Products/AdaptableStorage/mapper/SerializationEvent.py Mon Jan 6 09:55:09 2003
@@ -56,7 +56,13 @@
def notifySerialized(self, name, value, is_attribute):
"""See the ISerializationEvent interface."""
assert self._aspect_name is not None
- if value not in SIMPLE_IMMUTABLE_OBJECTS:
+ for ob in SIMPLE_IMMUTABLE_OBJECTS:
+ # If value is a simple immutable object, don't make a
+ # reference to it. Compare by identity rather than
+ # equality, otherwise rich comparison leads to surprises.
+ if value is ob:
+ break
+ else:
# Make internal references only for mutable or complex objects.
idx = id(value)
if not self._internal_refs.has_key(idx):