[Django] #24422: Messages framework not correctly encoding messages

19 views
Skip to first unread message

Django

unread,
Feb 26, 2015, 6:21:33 PM2/26/15
to django-...@googlegroups.com
#24422: Messages framework not correctly encoding messages
-------------------------------+--------------------
Reporter: YPCrumble | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
I'm using Django 1.7.5. I added the messages framework that added a cookie
to my machine. When I send a request from my browser, my cookie is
included in the following raw_cookie string:

'djdttop=29;
messages=71cd3671ca23bf7d6a599fb79d21a35c119780a4$[[\\"__json_message\\"\\0540\\05420\\054\\"This
is my message.\\"]\\054[\\"__json_message\\"\\0540\\05425\\054\\"My second
messages.\\"]]; sessionid=dqvje0lqh8czad0r7qxm2in4c7g3i25z;
djdtRedirectsPanel=on; djdtSettingsPanel=off; djdtHeadersPanel=off;
csrftoken=cRDz29PIcf0M2jmMgJdfehb8JUTvyPik; djdtTimerPanel=on; djdt=show'

When python tries to decode this string (using Cookie.SmartCookie), it
only outputs: <SmartCookie: djdttop='29'>

It's because my messages have been improperly encoded. If you take out the
messages from the string, the rest of the cookies decode fine. Somehow
Django isn't correctly encoding the messages cookie and it's interrupting
other cookies in my browser.

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

Django

unread,
Mar 2, 2015, 2:05:45 PM3/2/15
to django-...@googlegroups.com
#24422: Messages framework not correctly encoding messages
-------------------------------+--------------------------------------

Reporter: YPCrumble | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7
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
-------------------------------+--------------------------------------
Changes (by timgraham):

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


Comment:

If you are using Python 3.2.6, you are likely running into
http://bugs.python.org/issue22758.

If not, can you reproduce the issue without Django Debug Toolbar? We'll
likely need better steps to reproduce the issue.

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

Django

unread,
Mar 2, 2015, 3:18:15 PM3/2/15
to django-...@googlegroups.com
#24422: Messages framework not correctly encoding messages
-------------------------------+--------------------------------------

Reporter: YPCrumble | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7
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
-------------------------------+--------------------------------------

Comment (by YPCrumble):

I'm using Python 2.7.9.

I get the same issue when DjDT is not installed - the DjDT cookies just
aren't there in that case, but the messages cookie still messes things up
because it still has that `$` in the middle.

I'm somewhat new - let me know what info you'd like me to provide? If it
is an error I'd love to contribute a commit, but I haven't contributed to
open source code before so I'm not sure how to make that happen.

I believe the error is getting caught in line 91 of django.http.cookie.py.
The SimpleCookie referenced there can't access the messages cookie, which
has that `$` to split the cookie and the messages.

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

Django

unread,
Mar 2, 2015, 5:28:24 PM3/2/15
to django-...@googlegroups.com
#24422: Messages framework not correctly encoding messages
-------------------------------+--------------------------------------

Reporter: YPCrumble | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7
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
-------------------------------+--------------------------------------

Comment (by timgraham):

Steps to reproduce would include a code snippet of your usage of the
messages framework (in a view I'd guess) and then the steps to reproduce
the error using that code.

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

Django

unread,
Mar 3, 2015, 1:44:53 PM3/3/15
to django-...@googlegroups.com
#24422: Messages framework not correctly encoding messages
-------------------------------+--------------------------------------
Reporter: YPCrumble | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.7
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

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


Comment:

Please reopen when you provide those steps. I can't reproduce a problem.

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

Reply all
Reply to author
Forward
0 new messages