[Django] #28204: UnicodeDecodeError in paginate_queryset

4 views
Skip to first unread message

Django

unread,
May 13, 2017, 6:32:57 AM5/13/17
to django-...@googlegroups.com
#28204: UnicodeDecodeError in paginate_queryset
-----------------------------------------+------------------------
Reporter: Andrew | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.11
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 |
-----------------------------------------+------------------------
In Django 1.11.1 in function (django.views.generic.list.py):
paginate_queryset

{{{
try:
page = paginator.page(page_number)
return (paginator, page, page.object_list,
page.has_other_pages())
except InvalidPage as e:
raise Http404(_('Invalid page (%(page_number)s):
%(message)s') % {
'page_number': page_number,
'message': str(e)
}}}

line 'message': **str(e)** contains mistake. Maybe use **force_text**
instead of **str**
We have UnicodeDecodeError when non English locale:

EmptyPage(u'\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043d\u0435
\u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442
\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432',)

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

Django

unread,
May 13, 2017, 6:33:54 AM5/13/17
to django-...@googlegroups.com
#28204: UnicodeDecodeError in paginate_queryset
-------------------------------+--------------------------------------
Reporter: Andrew | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Andrew):

* type: Uncategorized => Bug
* component: Uncategorized => Generic views
* easy: 0 => 1


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

Django

unread,
May 14, 2017, 2:09:55 PM5/14/17
to django-...@googlegroups.com
#28204: UnicodeDecodeError in paginate_queryset
-------------------------------+--------------------------------------
Reporter: Andrew | Owner: nobody

Type: Bug | Status: new
Component: Generic views | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Andrew):

* Attachment "fix.patch" added.

Django

unread,
May 14, 2017, 2:10:40 PM5/14/17
to django-...@googlegroups.com
#28204: UnicodeDecodeError in paginate_queryset
-------------------------------+--------------------------------------
Reporter: Andrew | Owner: nobody

Type: Bug | Status: new
Component: Generic views | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Andrew):

* has_patch: 0 => 1
* needs_tests: 0 => 1


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

Django

unread,
May 14, 2017, 2:19:01 PM5/14/17
to django-...@googlegroups.com
#28204: UnicodeDecodeError in paginate_queryset
-------------------------------+--------------------------------------
Reporter: Andrew | Owner: nobody

Type: Bug | Status: new
Component: Generic views | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Andrew):

Regression in 6bd61194d49219276275542662e2fbe690534555

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

Django

unread,
May 14, 2017, 2:19:35 PM5/14/17
to django-...@googlegroups.com
#28204: UnicodeDecodeError in paginate_queryset
-------------------------------+--------------------------------------
Reporter: Andrew | Owner: nobody

Type: Bug | Status: new
Component: Generic views | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------
Description changed by Andrew:

Old description:

> In Django 1.11.1 in function (django.views.generic.list.py):
> paginate_queryset
>
> {{{
> try:
> page = paginator.page(page_number)
> return (paginator, page, page.object_list,
> page.has_other_pages())
> except InvalidPage as e:
> raise Http404(_('Invalid page (%(page_number)s):
> %(message)s') % {
> 'page_number': page_number,
> 'message': str(e)
> }}}
>
> line 'message': **str(e)** contains mistake. Maybe use **force_text**
> instead of **str**
> We have UnicodeDecodeError when non English locale:
>
> EmptyPage(u'\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043d\u0435
> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442
> \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432',)

New description:

In Django 1.11.1 in function (django.views.generic.list.py):
paginate_queryset

{{{
try:
page = paginator.page(page_number)
return (paginator, page, page.object_list,
page.has_other_pages())
except InvalidPage as e:
raise Http404(_('Invalid page (%(page_number)s):
%(message)s') % {
'page_number': page_number,
'message': str(e)
}}}

line 'message': **str(e)** contains mistake. Maybe use **force_text**
instead of **str**
We have UnicodeDecodeError when non English locale:

EmptyPage(u'\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043d\u0435
\u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442
\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432',)


Regression in 6bd61194d49219276275542662e2fbe690534555

--

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

Django

unread,
May 14, 2017, 2:28:37 PM5/14/17
to django-...@googlegroups.com
#28204: MultipleObjectMixin,paginate_queryset() crashes with UnicodeDecodeError if
InvalidPage message contains non-ASCII
-------------------------------+------------------------------------
Reporter: Andrew | Owner: nobody

Type: Bug | Status: new
Component: Generic views | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Tim Graham):

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


Comment:

After adding a test, you can send a pull request to the stable/1.11.x
branch since master doesn't support Python 2 and is thus unaffected as far
as I understand.

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

Django

unread,
May 29, 2017, 9:53:44 AM5/29/17
to django-...@googlegroups.com
#28204: MultipleObjectMixin.paginate_queryset() crashes with UnicodeDecodeError if

InvalidPage message contains non-ASCII
-------------------------------+------------------------------------
Reporter: Andrew | Owner: nobody

Type: Bug | Status: new
Component: Generic views | Version: 1.11
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):

* needs_tests: 1 => 0


Comment:

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

--
Ticket URL: <https://code.djangoproject.com/ticket/28204#comment:6>

Django

unread,
May 29, 2017, 10:13:06 AM5/29/17
to django-...@googlegroups.com
#28204: MultipleObjectMixin.paginate_queryset() crashes with UnicodeDecodeError if
InvalidPage message contains non-ASCII
-------------------------------+------------------------------------
Reporter: Andrew | Owner: nobody
Type: Bug | Status: closed

Component: Generic views | Version: 1.11
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:"c341803315c17f79a14acd88aaf1d44a23604c8b" c3418033]:
{{{
#!CommitTicketReference repository=""
revision="c341803315c17f79a14acd88aaf1d44a23604c8b"
[1.11.x] Fixed #28204 -- Fixed MultipleObjectMixin.paginate_queryset()
crash on Python 2 if InvalidPage message contains non-ASCII.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28204#comment:7>

Django

unread,
May 29, 2017, 10:25:46 AM5/29/17
to django-...@googlegroups.com
#28204: MultipleObjectMixin.paginate_queryset() crashes with UnicodeDecodeError if
InvalidPage message contains non-ASCII
-------------------------------+------------------------------------
Reporter: Andrew | Owner: nobody

Type: Bug | Status: closed
Component: Generic views | Version: 1.11
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
-------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"e84034b37a690889a2f77d85f85beebbd165598b" e84034b]:
{{{
#!CommitTicketReference repository=""
revision="e84034b37a690889a2f77d85f85beebbd165598b"
Refs #28204 - Forwardported 1.11.2 release note.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28204#comment:8>

Reply all
Reply to author
Forward
0 new messages