summaryrefslogtreecommitdiff
path: root/wsgitools
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2009-06-23 12:37:37 +0200
committerHelmut Grohne <helmut@subdivi.de>2009-06-23 12:37:37 +0200
commitba315d33219d09f3f92aca070a863cb0a03b2192 (patch)
treed489e7da8cae26ff074ccb4385ab3131a0ba11ee /wsgitools
parent56be1861917a9081a3883ae3b080d4683b52402c (diff)
downloadwsgitools-ba315d33219d09f3f92aca070a863cb0a03b2192.tar.gz
made RequestLogWSGIFilter define attrs in __init__
Diffstat (limited to 'wsgitools')
-rw-r--r--wsgitools/filters.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/wsgitools/filters.py b/wsgitools/filters.py
index 5b97e27..580a1c7 100644
--- a/wsgitools/filters.py
+++ b/wsgitools/filters.py
@@ -219,23 +219,31 @@ class RequestLogWSGIFilter(BaseWSGIFilter):
BaseWSGIFilter.__init__(self)
assert hasattr(log, "write")
self.log = log
+ self.remote = "?"
+ self.user = "-"
self.time = time.strftime("%d/%b/%Y:%T %z")
+ self.reqmethod = ""
+ self.path = ""
+ self.proto = None
+ self.status = ""
self.length = 0
+ self.referrer = None
+ self.useragent = None
def filter_environ(self, environ):
"""BaseWSGIFilter interface
@type environ: {str: str}
@rtype: {str: str}
"""
assert isinstance(environ, dict)
- self.remote = environ.get("REMOTE_ADDR", "?")
- self.user = environ.get("REMOTE_USER", "-")
+ self.remote = environ.get("REMOTE_ADDR", self.remote)
+ self.user = environ.get("REMOTE_USER", self.user)
self.reqmethod = environ["REQUEST_METHOD"]
self.path = environ["SCRIPT_NAME"] + environ["PATH_INFO"]
if environ.get("QUERY_STRING"):
self.path = "%s?%s" % (self.path, environ["QUERY_STRING"])
- self.proto = environ.get("SERVER_PROTOCOL", None)
- self.referrer = environ.get("HTTP_REFERER", "-")
- self.useragent = environ.get("HTTP_USER_AGENT", "-")
+ self.proto = environ.get("SERVER_PROTOCOL", self.proto)
+ self.referrer = environ.get("HTTP_REFERER", self.referrer)
+ self.useragent = environ.get("HTTP_USER_AGENT", self.useragent)
return environ
def filter_status(self, status):
"""BaseWSGIFilter interface