[Django] #22426: Django >= 1.6.0 can't handle old style messages cookie

12 views
Skip to first unread message

Django

unread,
Apr 12, 2014, 12:49:04 PM4/12/14
to django-...@googlegroups.com
#22426: Django >= 1.6.0 can't handle old style messages cookie
----------------------------------+-----------------------------------
Reporter: iivvoo | Owner: nobody
Type: Bug | Status: new
Component: contrib.messages | Version: 1.6
Severity: Normal | Keywords: messages, cookie, 1.4
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+-----------------------------------
The message cookie format has changed in Django 1.5.x, Django 1.6.x no
longer supports the old format.

If you upgrade your project from Django 1.4.x directly to 1.6.x (skipping
the 1.5 release), your application will fail quickly on old-style message
cookies:


{{{
Exception Type: IndexError
Exception Value:
list index out of range
Exception Location: (...) django/contrib/messages/storage/cookie.py in
process_messages, line 37
}}}


Django 1.5 contained some backward compatibility to handle both styles:

https://github.com/django/django/commit/9e7183073f64e541587e8dcfd8bb3ddeb47f8162

but this code is no longer present in Django 1.6.2

Since you can't ask all your users to delete their cookies if they run
into this error, there's no easy/quick workaround.

It's not uncommon for projects to skip a version. Also, Django 1.4.x is
LTS and people may jump from LTS release to LTS release, which means they
will also run into this issue.

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

Django

unread,
Apr 12, 2014, 1:14:03 PM4/12/14
to django-...@googlegroups.com
#22426: Django >= 1.6.0 can't handle old style messages cookie
-------------------------------------+-------------------------------------

Reporter: iivvoo | Owner: nobody
Type: Bug | Status: new
Component: contrib.messages | Version: 1.6
Severity: Normal | Resolution:
Keywords: messages, cookie, | Triage Stage:
1.4 | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

FWIW I've created a small piece of middleware as a workaround:
http://vanderwijk.info/blog/workaround-django-1-4-django-1-6-message-
cookie-error

but the real fix is to simply restore the backward compatibility from
Django 1.5

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

Django

unread,
Apr 12, 2014, 1:15:29 PM4/12/14
to django-...@googlegroups.com
#22426: Django >= 1.6.0 can't handle old style messages cookie
-------------------------------------+-------------------------------------

Reporter: iivvoo | Owner: nobody
Type: Bug | Status: new
Component: contrib.messages | Version: master
Severity: Release blocker | Resolution:
Keywords: messages, cookie, | Triage Stage: Accepted
1.4 | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by apollo13):

* version: 1.6 => master
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted


Comment:

Since the backwards compat code is only 2 lines, I'd leave it in there at
least till the next LTS. Needs backport to 1.6+

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

Django

unread,
Apr 15, 2014, 12:05:18 PM4/15/14
to django-...@googlegroups.com
#22426: Django >= 1.6.0 can't handle old style messages cookie
-------------------------------------+-------------------------------------
Reporter: iivvoo | Owner: ofirov
Type: Bug | Status: assigned
Component: contrib.messages | Version: 1.6

Severity: Release blocker | Resolution:
Keywords: messages, cookie, | Triage Stage: Accepted
1.4 | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0

Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by ofirov):

* owner: nobody => ofirov
* status: new => assigned
* has_patch: 0 => 1
* version: master => 1.6


Comment:

I just sent a pull request for a fix for this:
https://github.com/django/django/pull/2559

I added it to 1.6 and left it out of master.

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

Django

unread,
Apr 22, 2014, 4:47:22 AM4/22/14
to django-...@googlegroups.com
#22426: Django >= 1.6.0 can't handle old style messages cookie
-------------------------------------+-------------------------------------
Reporter: iivvoo | Owner: ofirov
Type: Bug | Status: closed
Component: contrib.messages | Version: 1.6
Severity: Release blocker | Resolution: fixed

Keywords: messages, cookie, | Triage Stage: Accepted
1.4 | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by Florian Apolloner <florian@…>):

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


Comment:

In [changeset:"f286721f7fdc2202f77a5f4d650d9d0779b86811"]:
{{{
#!CommitTicketReference repository=""
revision="f286721f7fdc2202f77a5f4d650d9d0779b86811"
Fixed #22426 -- Added support old-style d.c.messages format.

Forward ported code from 1.5 that adds backwards compatibility with legacy
message length.
See commit 9e7183073f64e541587e8dcfd8bb3ddeb47f8162 for details.

Thanks to Ofir Ovadia for the initial patch.
}}}

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

Django

unread,
Apr 22, 2014, 4:48:09 AM4/22/14
to django-...@googlegroups.com
#22426: Django >= 1.6.0 can't handle old style messages cookie
-------------------------------------+-------------------------------------
Reporter: iivvoo | Owner: ofirov
Type: Bug | Status: closed
Component: contrib.messages | Version: 1.6

Severity: Release blocker | Resolution: fixed
Keywords: messages, cookie, | Triage Stage: Accepted
1.4 | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by Florian Apolloner <florian@…>):

In [changeset:"97b5833e212d3e6520dfa43525aa75f625a760a0"]:
{{{
#!CommitTicketReference repository=""
revision="97b5833e212d3e6520dfa43525aa75f625a760a0"
[1.7.x] Fixed #22426 -- Added support old-style d.c.messages format.

Forward ported code from 1.5 that adds backwards compatibility with legacy
message length.
See commit 9e7183073f64e541587e8dcfd8bb3ddeb47f8162 for details.

Thanks to Ofir Ovadia for the initial patch.

Backport of f286721f7fdc2202f77a5f4d650d9d0779b86811 from master.
}}}

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

Django

unread,
Apr 22, 2014, 4:48:54 AM4/22/14
to django-...@googlegroups.com
#22426: Django >= 1.6.0 can't handle old style messages cookie
-------------------------------------+-------------------------------------
Reporter: iivvoo | Owner: ofirov
Type: Bug | Status: closed
Component: contrib.messages | Version: 1.6

Severity: Release blocker | Resolution: fixed
Keywords: messages, cookie, | Triage Stage: Accepted
1.4 | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by Florian Apolloner <florian@…>):

In [changeset:"6ec346ba7b251a9bcebcd467dde72463197ad210"]:
{{{
#!CommitTicketReference repository=""
revision="6ec346ba7b251a9bcebcd467dde72463197ad210"
[1.6.x] Fixed #22426 -- Added support old-style d.c.messages format.

Forward ported code from 1.5 that adds backwards compatibility with legacy
message length.
See commit 9e7183073f64e541587e8dcfd8bb3ddeb47f8162 for details.

Thanks to Ofir Ovadia for the initial patch.

Backport of f286721f7fdc2202f77a5f4d650d9d0779b86811 from master
}}}

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

Django

unread,
Jan 31, 2020, 5:11:36 AM1/31/20
to django-...@googlegroups.com
#22426: Django >= 1.6.0 can't handle old style messages cookie
-------------------------------------+-------------------------------------
Reporter: iivvoo | Owner: ofirov
Type: Bug | Status: closed
Component: contrib.messages | Version: 1.6

Severity: Release blocker | Resolution: fixed
Keywords: messages, cookie, | Triage Stage: Accepted
1.4 |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by GitHub <noreply@…>):

In [changeset:"e7d62e97eb40ab441778d1dff9885b5d892d0f80" e7d62e97]:
{{{
#!CommitTicketReference repository=""
revision="e7d62e97eb40ab441778d1dff9885b5d892d0f80"
Refs #22426 -- Removed pre-Django 1.5 messages compatibility code and
test.

This reverts commit f286721f7fdc2202f77a5f4d650d9d0779b86811.
}}}

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

Reply all
Reply to author
Forward
0 new messages