Undocumented contrib.sessions behaviour
|Reported by:||TomaszZielinski||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
When new session starts (sessionid not passed in cookies) and request.session.session_key is accessed before request.session["abc"], then:
1) request.session.session_key is generated,
2) first access to request.session[ "abc" ] calls request.session.load(), which overrides (by calling create()) request.session.session_key because the session_key cannot be found in DB.
This can be manually fixed by calling request.session.load() before using request.session.session_key.
I'm not sure if this is a bug or undocumented feature - I can send relevant patch depending on the answer.
Change History (10)
comment:1 Changed 6 years ago by Alex
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
comment:2 Changed 6 years ago by thejaswi_puthraya
- Component changed from Uncategorized to django.contrib.sessions
Changed 4 years ago by aaugustin
comment:8 Changed 3 years ago by aaugustin
- Resolution set to fixed
- Status changed from new to closed