diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-06-27 13:02:38 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-06-27 13:02:38 +0000 |
| commit | 7dc8b1a1a8a8e2771f37568a125fd51a3283b043 (patch) | |
| tree | 380030b51579474fb79cb6dc87b61227e17d4f54 /django/http | |
| parent | eeb4ffc2c1b9baaf9f8e87d14e24b1679f98f7b7 (diff) | |
Added a parameter to HttpResponse's constructor to enable explicit status 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
Diffstat (limited to 'django/http')
| -rw-r--r-- | django/http/__init__.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/http/__init__.py b/django/http/__init__.py index ca3b5eab24..1b2abe5049 100644 --- a/django/http/__init__.py +++ b/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 @@ class HttpResponse(object): 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" |
