Opened 11 years ago

Closed 11 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

Description

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 by Tim Graham, 11 years ago

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