Opened 8 years ago

Closed 8 years ago

#22582 closed Bug (worksforme)

Document the use of mutable objects in request.session

Reported by: PKL Owned by: nobody
Component: Documentation Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


Ive seen several colleagues being bitten when trying to add values to lists/dicts that they stored in sessions.

It should be very explicit, yelled, in the session docs, that mutable values must be handled with care, and that only top-level assignements are detected by the session (and thus pushed to the session stored on save). All other modifications have good chances to be lost after the request is over.

That behaviour of the django session is very similar to all object stores (ZODB, shove, bdb...), but people are rarely aware of that "mutation detection" issue, so this trap had better be displayed everywhere. B-)

Change History (1)

comment:1 Changed 8 years ago by Tim Graham

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top