diff options
| author | Tim Graham <timograham@gmail.com> | 2015-07-31 12:45:27 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-08-01 08:31:32 -0400 |
| commit | 6bb8258255cb2f739ba2a9a0af71b12d0b1f8af9 (patch) | |
| tree | 133954cc9e92c61c59230982c6f4b7c9be5937c6 | |
| parent | ef5cf564bff695049b3b51024d05c570be29e4cf (diff) | |
[1.8.x] Fixed #25204 -- Added missing space in runserver logging.
Backport of 1a76257b1b385ac8afd67bd36d061f508613e4d2 from master
| -rw-r--r-- | django/core/servers/basehttp.py | 2 | ||||
| -rw-r--r-- | tests/servers/test_basehttp.py | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/django/core/servers/basehttp.py b/django/core/servers/basehttp.py index c663fd968d..2fa0f6c033 100644 --- a/django/core/servers/basehttp.py +++ b/django/core/servers/basehttp.py @@ -107,7 +107,7 @@ class WSGIRequestHandler(simple_server.WSGIRequestHandler, object): def log_message(self, format, *args): - msg = "[%s]" % self.log_date_time_string() + msg = "[%s] " % self.log_date_time_string() try: msg += "%s\n" % (format % args) except UnicodeDecodeError: diff --git a/tests/servers/test_basehttp.py b/tests/servers/test_basehttp.py index 2f59b1358a..759ab522aa 100644 --- a/tests/servers/test_basehttp.py +++ b/tests/servers/test_basehttp.py @@ -12,6 +12,16 @@ class Stub(object): 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): request = WSGIRequest(RequestFactory().get('/').environ) request.makefile = lambda *args, **kwargs: BytesIO() |
