Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 2435

Show
Ignore:
Timestamp:
06/14/09 16:40:03
Author:
fumanchu
Message:

python3: Use new response.output_status for access log.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/python3/cherrypy/_cplogging.py

    r2390 r2435  
    77logfmt = logging.Formatter("%(message)s") 
    88import os 
    9 import email.utils  
     9import email.utils 
    1010import sys 
    1111 
     
    7878        outheaders = response.headers 
    7979        inheaders = request.headers 
     80        if response.output_status is None: 
     81            status = "-" 
     82        else: 
     83            status = str(response.output_status.split(b" ", 1)[0], 'ISO-8859-1') 
    8084         
    8185        atoms = {'h': remote.name or remote.ip, 
     
    8488                 't': self.time(), 
    8589                 'r': request.request_line, 
    86                  's': response.status.split(" ", 1)[0]
     90                 's': status
    8791                 'b': outheaders.get('Content-Length', '') or "-", 
    8892                 'f': inheaders.get('Referer', ''), 
     
    96100            # and backslash for us. All we have to do is strip the quotes. 
    97101            v = repr(v)[2:-1] 
    98  
     102             
    99103            # in python 3.0 the repr of bytes (as returned by encode)  
    100104            # uses double \'s.  But then the logger escapes them yet, again 
    101105            # resulting in quadruple slashes.  Remove the extra one here. 
    102106            v = v.replace('\\\\', '\\') 
    103  
     107             
    104108            # Escape double-quote. 
    105109            atoms[k] = v 

Hosted by WebFaction

Log in as guest/cpguest to create tickets