[1.8.x] Fixed #25204 -- Added missing space in runserver logging.
Backport of 1a76257b1b
from master
This commit is contained in:
parent
ef5cf564bf
commit
6bb8258255
|
@ -107,7 +107,7 @@ class WSGIRequestHandler(simple_server.WSGIRequestHandler, object):
|
||||||
|
|
||||||
def log_message(self, format, *args):
|
def log_message(self, format, *args):
|
||||||
|
|
||||||
msg = "[%s]" % self.log_date_time_string()
|
msg = "[%s] " % self.log_date_time_string()
|
||||||
try:
|
try:
|
||||||
msg += "%s\n" % (format % args)
|
msg += "%s\n" % (format % args)
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
|
|
|
@ -12,6 +12,16 @@ class Stub(object):
|
||||||
|
|
||||||
|
|
||||||
class WSGIRequestHandlerTestCase(TestCase):
|
class WSGIRequestHandlerTestCase(TestCase):
|
||||||
|
|
||||||
|
def test_log_message(self):
|
||||||
|
request = WSGIRequest(RequestFactory().get('/').environ)
|
||||||
|
request.makefile = lambda *args, **kwargs: BytesIO()
|
||||||
|
handler = WSGIRequestHandler(request, '192.168.0.2', None)
|
||||||
|
|
||||||
|
with captured_stderr() as stderr:
|
||||||
|
handler.log_message('GET %s %s', 'A', 'B')
|
||||||
|
self.assertIn('] GET A B', stderr.getvalue())
|
||||||
|
|
||||||
def test_https(self):
|
def test_https(self):
|
||||||
request = WSGIRequest(RequestFactory().get('/').environ)
|
request = WSGIRequest(RequestFactory().get('/').environ)
|
||||||
request.makefile = lambda *args, **kwargs: BytesIO()
|
request.makefile = lambda *args, **kwargs: BytesIO()
|
||||||
|
|
Loading…
Reference in New Issue