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.
* 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>
* 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>
* 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>
* 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>
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>
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>
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>