Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #112 -- WSGI handler now displays proper text status. Thanks, s…

…une.kirkeby@gmail.com!

git-svn-id: http://code.djangoproject.com/svn/django/trunk@297 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit d573cb021e69854d947dd988b6c9e492a688a377 1 parent 79026a6
Adrian Holovaty adrianholovaty authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 django/core/handlers/wsgi.py
12 django/core/handlers/wsgi.py
View
@@ -1,6 +1,12 @@
from django.utils import datastructures, httpwrappers
from pprint import pformat
+STATUS_CODE_TEXT = {
+ 200: 'OK',
+ 404: 'NOT FOUND',
+ 500: 'INTERNAL SERVER ERROR',
+}
+
class WSGIRequest(httpwrappers.HttpRequest):
def __init__(self, environ):
self.environ = environ
@@ -121,7 +127,11 @@ def __call__(self, environ, start_response):
for middleware_method in self._response_middleware:
response = middleware_method(request, response)
- status = str(response.status_code) + ' ' # TODO: Extra space here is a hack.
+ try:
+ status_text = STATUS_CODE_TEXT[response.status_code]
+ except KeyError:
+ status_text = 'UNKNOWN STATUS CODE'
+ status = '%s %s' % (response.status_code, status_text)
response_headers = response.headers
if response.cookies:
response_headers['Set-Cookie'] = response.cookies.output(header='')
Please sign in to comment.
Something went wrong with that request. Please try again.