[Zodb-checkins] CVS: Zope/lib/python/ZEO/zrpc - log.py:1.8.8.1

Jeremy Hylton cvs-admin at zope.org
Tue Oct 28 23:56:53 EST 2003


Update of /cvs-repository/Zope/lib/python/ZEO/zrpc
In directory cvs.zope.org:/tmp/cvs-serv9075

Modified Files:
      Tag: Zope-2_7-branch
	log.py 
Log Message:
Special case lists and tuples in short_repr().

The new invalidation code passes long lists of objects via RPC.  It
was very expensyive to generate the short_repr(), particularly since
it was thrown away unless debug logging was turned on.


=== Zope/lib/python/ZEO/zrpc/log.py 1.8 => 1.8.8.1 ===
--- Zope/lib/python/ZEO/zrpc/log.py:1.8	Thu Apr 17 17:16:49 2003
+++ Zope/lib/python/ZEO/zrpc/log.py	Tue Oct 28 23:56:52 2003
@@ -45,7 +45,7 @@
     # The pickle is near the beginning, too, and you can often fit the
     # module name in the pickle.
 
-    if isinstance(obj, types.StringType):
+    if isinstance(obj, str):
         if len(obj) > REPR_LIMIT:
             r = repr(obj[:REPR_LIMIT])
         else:
@@ -53,7 +53,7 @@
         if len(r) > REPR_LIMIT:
             r = r[:REPR_LIMIT-4] + '...' + r[-1]
         return r
-    elif isinstance(obj, types.TupleType):
+    elif isinstance(obj, (list, tuple)):
         elts = []
         size = 0
         for elt in obj:
@@ -62,7 +62,10 @@
             size += len(r)
             if size > REPR_LIMIT:
                 break
-        r = "(%s)" % (", ".join(elts))
+        if isinstance(obj, tuple):
+            r = "(%s)" % (", ".join(elts))
+        else:
+            r = "[%s]" % (", ".join(elts))
     else:
         r = repr(obj)
     if len(r) > REPR_LIMIT:




More information about the Zodb-checkins mailing list