[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/testing/dochttp.py only append "..." line to cleaned redirect test if there is a non-empty

Fred L. Drake, Jr. fdrake at gmail.com
Tue Aug 9 16:00:56 EDT 2005


Log message for revision 37820:
  only append "..." line to cleaned redirect test if there is a non-empty
  response body
  

Changed:
  U   Zope3/trunk/src/zope/app/testing/dochttp.py

-=-
Modified: Zope3/trunk/src/zope/app/testing/dochttp.py
===================================================================
--- Zope3/trunk/src/zope/app/testing/dochttp.py	2005-08-09 18:33:26 UTC (rev 37819)
+++ Zope3/trunk/src/zope/app/testing/dochttp.py	2005-08-09 20:00:55 UTC (rev 37820)
@@ -129,13 +129,15 @@
     print '  >>> print http(r"""'
     print '  ...', '\n  ... '.join(request.lines())+'""")'
     if response.code in (301, 302, 303) and clean_redirects:
+        content_length = None
         if response.headers:
             for i in range(len(response.headers)):
                 h, v = response.headers[i]
                 if h == "Content-Length":
+                    content_length = int(v.strip())
                     response.headers[i] = (h, "...")
         lines = response.header_lines()
-        if lines:
+        if lines and content_length:
             lines.append("...")
     else:
         lines = response.lines()



More information about the Zope3-Checkins mailing list