[Django] #27517: TemplateResponseMixin with charset does not worked

12 views
Skip to first unread message

Django

unread,
Nov 21, 2016, 6:49:17 AM11/21/16
to django-...@googlegroups.com
#27517: TemplateResponseMixin with charset does not worked
------------------------------------------+------------------------
Reporter: Kosei Kitahara | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------+------------------------
When create class based view which contain `TemplateResponseMixin`,

```
class MyTemplateView(TemplateResponseMixin, ContextMixin, View):
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
return self.render_to_response(context,
charset=kwargs.get('charset', 'utf-8'))
```

`TemplateResponseMixin.render_to_response` call `SimpleTemplateResponse.
__init__` with a `charset` keyword argument.
But above method passed charset which is none-keyword argument.
Also `content_type` and `status` are same too.

--
Ticket URL: <https://code.djangoproject.com/ticket/27517>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 21, 2016, 6:50:34 AM11/21/16
to django-...@googlegroups.com
#27517: TemplateResponseMixin with charset does not worked
--------------------------------+--------------------------------------

Reporter: Kosei Kitahara | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: 1.10
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Description changed by Kosei Kitahara:

Old description:

> When create class based view which contain `TemplateResponseMixin`,
>
> ```
> class MyTemplateView(TemplateResponseMixin, ContextMixin, View):
> def get(self, request, *args, **kwargs):
> context = self.get_context_data(**kwargs)
> return self.render_to_response(context,
> charset=kwargs.get('charset', 'utf-8'))
> ```
>
> `TemplateResponseMixin.render_to_response` call `SimpleTemplateResponse.
> __init__` with a `charset` keyword argument.
> But above method passed charset which is none-keyword argument.
> Also `content_type` and `status` are same too.

New description:

When create class based view which contain `TemplateResponseMixin`,

{{{
class MyTemplateView(TemplateResponseMixin, ContextMixin, View):
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
return self.render_to_response(context,
charset=kwargs.get('charset', 'utf-8'))
}}}

`TemplateResponseMixin.render_to_response` call `SimpleTemplateResponse.
__init__` with a `charset` keyword argument.
But above method passed charset which is none-keyword argument.
Also `content_type` and `status` are same too.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27517#comment:1>

Django

unread,
Nov 21, 2016, 9:12:28 AM11/21/16
to django-...@googlegroups.com
#27517: TemplateResponseMixin with charset does not worked
--------------------------------+--------------------------------------

Reporter: Kosei Kitahara | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: 1.10
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Description changed by Kosei Kitahara:

Old description:

> When create class based view which contain `TemplateResponseMixin`,


>
> {{{
> class MyTemplateView(TemplateResponseMixin, ContextMixin, View):
> def get(self, request, *args, **kwargs):
> context = self.get_context_data(**kwargs)
> return self.render_to_response(context,
> charset=kwargs.get('charset', 'utf-8'))
> }}}
>
> `TemplateResponseMixin.render_to_response` call `SimpleTemplateResponse.
> __init__` with a `charset` keyword argument.
> But above method passed charset which is none-keyword argument.
> Also `content_type` and `status` are same too.

New description:

When create a class based view which contain `TemplateResponseMixin`,

{{{
class MyTemplateView(TemplateResponseMixin, ContextMixin, View):
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
return self.render_to_response(context,
charset=kwargs.get('charset', 'utf-8'))
}}}

`TemplateResponseMixin.render_to_response` calls `SimpleTemplateResponse.


__init__` with a `charset` keyword argument.

But, the above method passed `charset` as a non-keyword argument.
In addition, `content_type`, `status` are passed also as nonーkeyword
arguments, which seems in a wrong order.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27517#comment:2>

Django

unread,
Nov 22, 2016, 10:12:19 AM11/22/16
to django-...@googlegroups.com
#27517: TemplateResponseMixin with charset does not work
--------------------------------+--------------------------------------

Reporter: Kosei Kitahara | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: 1.10
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/27517#comment:3>

Django

unread,
Nov 22, 2016, 1:31:06 PM11/22/16
to django-...@googlegroups.com
#27517: TemplateResponseMixin with charset does not work
--------------------------------+------------------------------------

Reporter: Kosei Kitahara | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------
Changes (by Tim Graham):

* has_patch: 0 => 1
* stage: Unreviewed => Accepted


Comment:

[https://github.com/django/django/pull/7588 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/27517#comment:4>

Django

unread,
Nov 24, 2016, 5:56:58 AM11/24/16
to django-...@googlegroups.com
#27517: TemplateResponseMixin with charset does not work
--------------------------------+------------------------------------

Reporter: Kosei Kitahara | Owner: nobody
Type: Bug | Status: closed

Component: Generic views | Version: 1.10
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"f095b249baf34bbdd4c0b28c9bde05b4d20681be" f095b249]:
{{{
#!CommitTicketReference repository=""
revision="f095b249baf34bbdd4c0b28c9bde05b4d20681be"
Fixed #27517 -- Fixed charset param in SimpleTemplateResponse.__init__().
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27517#comment:5>

Reply all
Reply to author
Forward
0 new messages