[Django] #26746: Accept-Language header parsing incorrectly transforms q=0 into q=1

21 views
Skip to first unread message

Django

unread,
Jun 11, 2016, 1:40:06 PM6/11/16
to django-...@googlegroups.com
#26746: Accept-Language header parsing incorrectly transforms q=0 into q=1
----------------------------+--------------------
Reporter: vytisb | Owner: nobody
Type: Bug | Status: new
Component: Utilities | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------
Given an Accept-Language header `en;q=0`, `parse_accept_lang_header`
returns `[('en', 1.0)]`, which makes `en` the most preferable language in
this case.
According to [https://tools.ietf.org/html/rfc7231#section-5.3.1 RFC 7231],
this should not happen.

Also interesting that we have
[https://github.com/django/django/blob/bb7bb379e8cd91a91336946829519d64e919a1d2/tests/i18n/tests.py#L1318
a test for this behavior].

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

Django

unread,
Jun 11, 2016, 9:36:09 PM6/11/16
to django-...@googlegroups.com
#26746: Accept-Language header parsing incorrectly transforms q=0 into q=1
--------------------------------------+------------------------------------

Reporter: vytisb | Owner: nobody
Type: Bug | Status: new
Component: Internationalization | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_better_patch: => 0
* needs_docs: => 0
* component: Utilities => Internationalization
* needs_tests: => 0
* stage: Unreviewed => Accepted


Comment:

The fallback to "1.0" is present since the `Accept-Language` parsing was
introduced in 842a771e0527c36a9bcb3984057bb30903e71af3 (tests added in the
next commit: a14256aade963929743aa09e0834f5fc4072f772).

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

Django

unread,
Jun 12, 2016, 8:38:19 AM6/12/16
to django-...@googlegroups.com
#26746: Accept-Language header parsing incorrectly transforms q=0 into q=1
--------------------------------------+------------------------------------
Reporter: vytisb | Owner: vytisb
Type: Bug | Status: assigned

Component: Internationalization | Version: master
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 vytisb):

* status: new => assigned
* owner: nobody => vytisb
* has_patch: 0 => 1


Comment:

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

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

Django

unread,
Jun 13, 2016, 7:58:44 AM6/13/16
to django-...@googlegroups.com
#26746: Accept-Language header parsing incorrectly transforms q=0 into q=1
--------------------------------------+------------------------------------
Reporter: vytisb | Owner: vytisb
Type: Bug | Status: closed
Component: Internationalization | Version: master
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: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"57eb17b8c7d106c9a3264aa35b8dabb179a1e17b" 57eb17b]:
{{{
#!CommitTicketReference repository=""
revision="57eb17b8c7d106c9a3264aa35b8dabb179a1e17b"
Fixed #26746 -- Fixed handling of zero priority in Accept-Language header
parsing.
}}}

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

Reply all
Reply to author
Forward
0 new messages