[Zope-Checkins] CVS: ZODB3/ZODB/zodb4 - z4iterator.py:1.1.2.4

Fred L. Drake, Jr. fred at zope.com
Thu Jan 29 17:08:46 EST 2004


Update of /cvs-repository/ZODB3/ZODB/zodb4
In directory cvs.zope.org:/tmp/cvs-serv587

Modified Files:
      Tag: zope3-zodb3-devel-branch
	z4iterator.py 
Log Message:
we need to avoid passing Unicode strings to ZODB 3 for the user and
description fields; it forces OIDs to get converted to Unicode, and
that doesn't make sense


=== ZODB3/ZODB/zodb4/z4iterator.py 1.1.2.3 => 1.1.2.4 ===
--- ZODB3/ZODB/zodb4/z4iterator.py:1.1.2.3	Thu Jan 29 16:30:47 2004
+++ ZODB3/ZODB/zodb4/z4iterator.py	Thu Jan 29 17:08:45 2004
@@ -144,8 +144,8 @@
     def __init__(self, tid, status, user, desc, ext, pos, tend, file, tpos):
         self.tid = tid
         self.status = status
-        self.user = user
-        self.description = desc
+        self.user = str8(user)
+        self.description = str8(desc)
         self._extension = ext
         self._pos = pos
         self._tend = tend
@@ -199,3 +199,12 @@
         self.data = data
         self.data_txn = data_txn
         self.refs = refs
+
+# convert unicode strings to 8-bit strings
+
+def str8(s):
+    if isinstance(s, unicode):
+        # Should we use UTF-8 or ASCII?  Not sure.
+        return s.encode("ascii")
+    else:
+        return s




More information about the Zope-Checkins mailing list