﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
12747	Custom HTTP status reason phrases are not supported	Gustavo Narea	gisle	"At present, Django hard-codes the ''HTTP status reason phrases'' based on an integer that represents the ''HTTP status code'', forcing the recommended phrases by the HTTP specification.

Note they are just the recommended/default phrases and developers should be allowed to override these phrases. For example, I may want to return the following and Django should allow me to do so:
{{{
403 Get out
}}}

Or,
{{{
200 Everything is fine
}}}

See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1

In order to support this, Django could have the following code in ''django.http:HttpResponse.__init!__'':
{{{
        if isinstance(status, basestring):
            # The status is given as a real HTTP status header, so we should
            # tell the code and the reason apart for Django:
            (status_code, status_reason) = status.split("" "", 1)
            status_code = int(status_code)
            self.status_reason = status_reason or None
        else:
            # The status has been given the old way supported by Django, simply
            # the status code as an integer:
            status_code = status
            self.status_reason = None
}}}

And the following on ''django.core.handlers.wsgi:WSGIHandler.__call!__()'':
{{{
        if response.status_reason:
            status_text = ""%s %s"" % (response.status_code, response.status_reason)
        else:
            try:
                status_text = STATUS_CODE_TEXT[response.status_code]
            except KeyError:
                status_text = 'UNKNOWN STATUS CODE'
}}}

If any Django user wants to use this functionality before it gets implemented, they may use twod.wsgi: http://bitbucket.org/2degrees/twod.wsgi/"	New feature	closed	HTTP handling	dev	Normal	fixed	http status, http status reason, http status reason phrase	akvadrako	Accepted	1	0	0	0	0	0
