﻿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
18678	HTTPResponse subclasses don't accept base class parameters	hp1337@…	nobody	"I would like to pass {{{content_type}}} when creating a new {{{HttpResponseNotAllowed}}} object. Unfortunately, it does not accept parameters from its base class, {{{HttpResponse}}}. Doing the following results in an error:

{{{
#!python
return HttpResponseNotAllowed(content_type=""application/json"", permitted_methods=['POST'], )
}}}

There is a simple fix to this. See my patch below. This patch should be applied to other {{{HttpResponse}}} sub-classes as well. Namely, {{{HttpResponseRedirect}}} and {{{HttpResponsePermanentRedirect}}}.

{{{
#!python
class HttpResponseNotAllowed(HttpResponse):
    status_code = 405

    def __init__(self, permitted_methods, *args, **kwargs):
        super(HttpResponseNotAllowed, self).__init__(*args, **kwargs)
        self['Allow'] = ', '.join(permitted_methods)
}}}"	Bug	closed	HTTP handling	dev	Normal	fixed			Accepted	1	0	0	0	0	0
