Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a parameter to HttpResponse's constructor to enable explicit st…

…atus code

setting. This will save us from being asked to add a subclass for every
possible HTTP status code.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5554 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 7dc8b1a1a8a8e2771f37568a125fd51a3283b043 1 parent eeb4ffc
@malcolmt malcolmt authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 django/http/__init__.py
View
4 django/http/__init__.py
@@ -162,7 +162,7 @@ class HttpResponse(object):
status_code = 200
- def __init__(self, content='', mimetype=None):
+ def __init__(self, content='', mimetype=None, status=None):
from django.conf import settings
self._charset = settings.DEFAULT_CHARSET
if not mimetype:
@@ -175,6 +175,8 @@ def __init__(self, content='', mimetype=None):
self._is_string = True
self.headers = {'Content-Type': mimetype}
self.cookies = SimpleCookie()
+ if status:
+ self.status_code = status
def __str__(self):
"Full HTTP message, including headers"
Please sign in to comment.
Something went wrong with that request. Please try again.