Opened 16 years ago

Last modified 13 years ago

#7233 closed

placing request.POST.copy() in session wipes all session values — at Initial Version

Reported by: mikechambers Owned by: nobody
Component: contrib.sessions Version: dev
Severity: Keywords:
Cc: rajesh.dhawan@…, dsalvetti@…, philipp@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Version : (0, 97, 'pre')

The issue is that it appears trying to store a QueryDict (request.POST, or a copy of a QueryDict) in the session, will wipe all session data.

You can see the original thread here:

http://groups.google.com/group/django-users/browse_thread/thread/260d9b94f773655e

Basically:

request.session['form_post_data'] = request.POST.copy()
request.session['foo'] = "bar"

Then, in another request:

print request.session.keys()

prints []

(i.e. no keys)

But:

request.session['foo'] = "bar"

then in another request:

print request.session.keys()
prints ['foo']

There seems to be two potential issues:

  1. Cannot store request.POST.copy() or request.POST in the session (should you be able to do this?)
  2. Trying to place request.POST.copy() in the session wipes all session values.

More info on the following threads:

http://groups.google.com/group/django-users/browse_thread/thread/260d9b94f773655e

and

http://groups.google.com/group/django-developers/browse_thread/thread/ec651a3b5f877698

Change History (2)

by mikechambers, 16 years ago

Attachment: sessiontest.zip added

test project that reproduces issue

by rajesh.dhawan@…, 16 years ago

Attachment: querydict_pickle_fix.diff added

Fix to make copies of QueryDict instances pickle/unpickle friendly

Note: See TracTickets for help on using tickets.
Back to Top