[Zope-CVS] CVS: Products/AdaptableStorage/mapper - SerializationEvent.py:1.1.2.1

Christian Zagrodnick cz@gocept.com
Sat, 4 Jan 2003 14:06:41 -0500


Update of /cvs-repository/Products/AdaptableStorage/mapper
In directory cvs.zope.org:/tmp/cvs-serv11843

Modified Files:
      Tag: zagy-patches
	SerializationEvent.py 
Log Message:
Fixed UnicodeError:
    code like '\202\201' in (u'', ) raises a UnicodeError, thus it was not
    possible to upload binary data.


=== Products/AdaptableStorage/mapper/SerializationEvent.py 1.1 => 1.1.2.1 ===
--- Products/AdaptableStorage/mapper/SerializationEvent.py:1.1	Tue Dec 31 16:47:46 2002
+++ Products/AdaptableStorage/mapper/SerializationEvent.py	Sat Jan  4 14:06:39 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:
+        isSimple = 0
+        try:
+            if value in SIMPLE_IMMUTABLE_OBJECTS:
+                isSimple = 1
+        except UnicodeError:
+            pass
+        if not isSimple:
             # Make internal references only for mutable or complex objects.
             idx = id(value)
             if not self._internal_refs.has_key(idx):