more robust error routine.

self.ctx may be unset in case of bad request or other low-level error.
This commit is contained in:
Vladimir Homutov
2016-10-10 16:39:56 +03:00
parent 52d5cba3e9
commit 7f3634bba0
+6 -1
View File
@@ -126,7 +126,12 @@ class AuthHandler(BaseHTTPRequestHandler):
else:
addr = "-"
sys.stdout.write("%s - %s [%s] %s\n" % (addr, self.ctx['user'],
if not hasattr(self, 'ctx'):
user = '-'
else:
user = ctx['user']
sys.stdout.write("%s - %s [%s] %s\n" % (addr, user,
self.log_date_time_string(), format % args))
def log_error(self, format, *args):