#22427: Session entry disappears before it can be saved
---------------------------+-----------------------------------------------
     Reporter:  anonymous  |      Owner:  nobody
         Type:  Bug        |     Status:  new
    Component:             |    Version:  1.6
  contrib.sessions         |   Keywords:  session dict disappear middleware
     Severity:  Normal     |  Has patch:  0
 Triage Stage:             |      UI/UX:  0
  Unreviewed               |
Easy pickings:  0          |
---------------------------+-----------------------------------------------
 I am running the exact same code on my local development machine and a
 production server.

 Everything important I can think of is the same: both Ubuntu 13.10, both
 Python 2.7.5+, both Django 1.6.2, etc.

 Yet the two machines are producing different behaviour!

 I modified the file django/contrib/sessions/middleware.py, like so:

 {{{
 import sys
 sys.stderr.write('\nBefore!\n')
 for key, value in request.session.iteritems():
    sys.stderr.write('%s=%s\n'%(key, value))
 request.session.save()
 sys.stderr.write('\nAfter!\n')
 for key, value in request.session.iteritems():
    sys.stderr.write('%s=%s\n'%(key, value))
 }}}

 So I am "printing" the session data before and after it is saved in the
 middleware.

 On my machine, the data in question is present before and after (e.g. key
 = 'hello', value = '123'), but on the production server, the data in
 question is neither present before or after the save.

 I have no idea how this is possible, but it's happening and driving me
 crazy.

 Note: I am setting the session entry like so (in my view):
 {{{
 request.session['hello'] = '123'
 }}}
 So somewhere between that dict insertion and the middleware processing,
 the entry is completely disappearing, yet both machines are running
 identical code!

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.22784572e9df6fa0ee0abe90f34a2e44%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to