[Checkins] SVN: zc.zservertracelog/trunk/src/zc/zservertracelog/ Fix test failure and some typos.

Marius Gedminas marius at pov.lt
Tue Jan 10 01:08:13 UTC 2012


Log message for revision 124010:
  Fix test failure and some typos.
  
  Reconstructing svn history:
  
  * in r91096 in a alex-extensions-2 branch of zc.zservertracelog asmith added a
    test to ensure that for a request like 'GET /path?' the path ends up in the
    tracelog with a trailing question mark.
  
  * in r91938 of zc.zservertracelog asmith merged that branch to trunk.
  
  * in r115365 of zope.server srichter changed zope.server.httpparser to
    normalize the query string: '' gets converted to None in parser.query.
    The special case of zc.zservertracelog is never triggered if you
    use zope.server >= 3.7.0, and we end up with a failing test.
  
  The code in zc.zservertracelog is fine, and if people want explicit trailing
  question marks in their logs for this case, let them go and fix zope.server.
  My hands are full of yak hair as it is.
  
  

Changed:
  U   zc.zservertracelog/trunk/src/zc/zservertracelog/README.txt
  U   zc.zservertracelog/trunk/src/zc/zservertracelog/tracelog.py

-=-
Modified: zc.zservertracelog/trunk/src/zc/zservertracelog/README.txt
===================================================================
--- zc.zservertracelog/trunk/src/zc/zservertracelog/README.txt	2012-01-10 00:48:43 UTC (rev 124009)
+++ zc.zservertracelog/trunk/src/zc/zservertracelog/README.txt	2012-01-10 01:08:12 UTC (rev 124010)
@@ -16,7 +16,7 @@
     >>> stdout_handler = logging.StreamHandler(sys.stdout)
 
 The logger's name is not the package name, but "zc.tracelog" for backward
-compatability.
+compatibility.
 
     >>> logger = logging.getLogger('zc.tracelog')
     >>> logger.setLevel(logging.INFO)
@@ -82,7 +82,7 @@
    An application thread began processing the request.
 
 A
-   The esponse was computed.
+   The response was computed.
 
 E
    The request ended.
@@ -182,22 +182,7 @@
     A 21598352 2008-09-12 11:40:27.000000 200 ?
     E 21598352 2008-09-12 11:40:27.000000
 
-Empty query strings are also preserved.
 
-    >>> req4 = """\
-    ... GET /test-req4/? HTTP/1.1
-    ... Host: www.example.com/empty-query-string
-    ...
-    ... """
-
-    >>> invokeRequest(req4)
-    B 21598352 2008-09-12 11:40:27.000000 GET /test-req4/?
-    I 21598352 2008-09-12 11:40:27.000000 0
-    C 21598352 2008-09-12 11:40:27.000000
-    A 21598352 2008-09-12 11:40:27.000000 200 ?
-    E 21598352 2008-09-12 11:40:27.000000
-
-
 Adding Additional Entries to the Trace Log
 ==========================================
 
@@ -224,7 +209,7 @@
 Database statistics
 ===================
 
-zc.zservertracelog provides event subscrivers that gather statistics
+zc.zservertracelog provides event subscribers that gather statistics
 about database usage in a request.  It assumes that requests have
 'ZODB.interfaces.IConnection' annotations that are ZODB database
 connections. To demonstrate how this works, we'll create a number of
@@ -253,7 +238,7 @@
 databases.
 
 We simulate a request that calls the traversal hooks a couple of
-times,does some database activity and redoes requests due to conflicts.
+times, does some database activity and redoes requests due to conflicts.
 
     >>> def dbapp1(environ, start_response):
     ...     conn = Connection(environ, '', 'x', 'y')

Modified: zc.zservertracelog/trunk/src/zc/zservertracelog/tracelog.py
===================================================================
--- zc.zservertracelog/trunk/src/zc/zservertracelog/tracelog.py	2012-01-10 00:48:43 UTC (rev 124009)
+++ zc.zservertracelog/trunk/src/zc/zservertracelog/tracelog.py	2012-01-10 01:08:12 UTC (rev 124010)
@@ -82,10 +82,9 @@
 
     def handle_request(self, parser):
         full_path = parser.path
-        if parser.query:
+        # If parser.query == '' we want full_path with a trailing '?'
+        if parser.query is not None:
             full_path += '?%s' % parser.query
-        elif parser.query is not None:
-            full_path += '?'
 
         cid = id(self)
         _log(cid, 'B', '%s %s' % (parser.command, full_path), parser.__B)



More information about the checkins mailing list