[Zope3-checkins] CVS: Zope3/lib/python/Zope/Server/HTTP - CommonHitLogger.py:1.3 HTTPTask.py:1.3

Steve Alexander steve@cat-box.net
Fri, 8 Nov 2002 09:35:29 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Server/HTTP
In directory cvs.zope.org:/tmp/cvs-serv31354/lib/python/Zope/Server/HTTP

Modified Files:
	CommonHitLogger.py HTTPTask.py 
Log Message:
various changes and a small refactoring to the Logger package.
This is the package that logs requests, typically in zope2 to a
Z2.log, and in zope3 by default to stdout.


=== Zope3/lib/python/Zope/Server/HTTP/CommonHitLogger.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/Server/HTTP/CommonHitLogger.py:1.2	Mon Jun 10 19:29:35 2002
+++ Zope3/lib/python/Zope/Server/HTTP/CommonHitLogger.py	Fri Nov  8 09:34:58 2002
@@ -24,15 +24,16 @@
 from Zope.Server.Logger.ResolvingLogger import ResolvingLogger
 from Zope.Server.Logger.UnresolvingLogger import UnresolvingLogger
 
-
 class CommonHitLogger:
     """Outputs hits in common HTTP log format.
     """
 
     def __init__(self, logger_object=None, resolver=None):
         if logger_object is None:
+            # logger_object is an IMessageLogger
             logger_object = FileLogger(sys.stdout)
 
+        # self.output is an IRequestLogger
         if resolver is not None:
             self.output = ResolvingLogger(resolver, logger_object)
         else:
@@ -86,7 +87,7 @@
         user_agent = req_headers.get('USER_AGENT', '')
         referer = req_headers.get('REFERER', '')
 
-        self.output.log(
+        self.output.logRequest(
             task.channel.addr[0],
             ' - %s [%s] "%s" %s %d "%s" "%s"\n' % (
                 user_name,


=== Zope3/lib/python/Zope/Server/HTTP/HTTPTask.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/Server/HTTP/HTTPTask.py:1.2	Mon Jun 10 19:29:35 2002
+++ Zope3/lib/python/Zope/Server/HTTP/HTTPTask.py	Fri Nov  8 09:34:58 2002
@@ -26,14 +26,12 @@
 from Zope.Server.IHeaderOutput import IHeaderOutput
 from Zope.Server.ITask import ITask
 
-
 rename_headers = {
     'CONTENT_LENGTH' : 'CONTENT_LENGTH',
     'CONTENT_TYPE'   : 'CONTENT_TYPE',
     'CONNECTION'     : 'CONNECTION_TYPE',
     }
 
-
 class HTTPTask:
     """An HTTP task accepts a request and writes to a channel.
 
@@ -155,8 +153,8 @@
     def buildResponseHeader(self):
         self.prepareResponseHeaders()
         first_line = 'HTTP/%s %s %s' % (self.version, self.status, self.reason)
-        lines = [first_line] + map(
-            lambda hv: '%s: %s' % hv, self.response_headers.items())
+        lines = [first_line] + ['%s: %s' % hv
+                                for hv in self.response_headers.items()]
         accum = self.accumulated_headers
         if accum is not None:
             lines.extend(accum)