Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#5667 closed (wontfix)

Session backend does not work for db backend

Reported by: aaloy@… Owned by: nobody
Component: Uncategorized Version: dev
Severity: Keywords: session cache backend
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Using the default database backend for the session, the session values are not stored, so it can't not be retrieved when requested. If you configure the session engine to be caché based and you configure the cache_backend as memcached or locmem for example. it works properly.

I have tried to drop and syncdb the session table without succes.

I you configure the cache backend as file you'll get an error trying to store the session.

The django.contrib.sessions.backends.file does not work either.

I'm on the 0.97-pre-SVN-6443 branch and using sqlite as the development database.

Change History (3)

comment:1 by aaloy, 17 years ago

Resolution: wontfix
Status: newclosed

It seems the problem is not with the session itself it's about an exception handler which captures to much errors in the db session engine. The problem could be reproduced if you try to save into a session a QueryDict. It should raise an exception saying you could not store that object but simply it does nothing.
Just when I put the application on another machine and tried to use the file based session I realized of the problem, as it throws an exception saying than QueryDict has not _mutable attribute.

comment:2 by anonymous, 17 years ago

Hi!
I stumbled also over this problem. Would be nice to have an exception though!

comment:3 by Anders Olsson, 17 years ago

I had the same problem, I was storing the POST dictionary (a QueryDict) in the session:

request.session["posted"] = request.POST

This seems to have the effect of silently invalidating the session, since when I access the session in a later request I get a clean session object. I don't have time to investigate this further right now, I've just fixed it this way for now:

request.session["posted"] = dict(request.POST.items())

This creates an ordinary dict and stores that instead. I'm pretty sure the original code worked fine earlier, which is why it took me a good deal of time before I found this error.

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