[Zope-CVS] CVS: Products/Ape/lib/apelib/zodb3 - serializers.py:1.7

Shane Hathaway shane at zope.com
Thu Feb 19 13:21:01 EST 2004


Update of /cvs-repository/Products/Ape/lib/apelib/zodb3
In directory cvs.zope.org:/tmp/cvs-serv20077/lib/apelib/zodb3

Modified Files:
	serializers.py 
Log Message:
Minor formatting change in the pickle text encoding: no empty line.


=== Products/Ape/lib/apelib/zodb3/serializers.py 1.6 => 1.7 ===
--- Products/Ape/lib/apelib/zodb3/serializers.py:1.6	Thu Feb 19 01:44:05 2004
+++ Products/Ape/lib/apelib/zodb3/serializers.py	Thu Feb 19 13:21:00 2004
@@ -60,13 +60,17 @@
     if unmanaged_count:
         comments.append('# unmanaged persistent objects: %d' % unmanaged_count)
     text = base64.encodestring(s)
-    return '%s\n\n%s' % ('\n'.join(comments), text)
+    return '%s\n%s' % ('\n'.join(comments), text)
 
 def decodeFromText(s):
     """Decodes using base 64, ignoring leading comments.
     """
-    # Ignore everything before the blank line.
-    s = s.split('\n\n', 1)[-1]
+    i = s.rfind('#')
+    if i >= 0:
+        j = s.find('\n', i)
+        if j >= 0:
+            # Remove the comments.
+            s = s[j + 1:].strip()
     return base64.decodestring(s)
 
 




More information about the Zope-CVS mailing list