Opened 18 years ago
Closed 18 years ago
#3239 closed enhancement (invalid)
clear session method
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Contrib apps | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
For some types of applications it's necessary/desirable to clear session variables at specific events (e.g. server start, user login). It would be convenient to have the following (untested) method available in SessionWrapper:
def clear(self): try: self._session_cache.clear() except AttributeError: pass self._session.clear()
I'm aware the Django policy is to not make it easy for users to delete data, but this is pretty explicit that you want to clear your session data.
Note:
See TracTickets
for help on using tickets.
Upon further investigation of session data, I'm going to rescind my request. Session data is used by the system in ways the programmer may not anticipate: e.g.:
I'll probably hack a method to clear my user session data based on the underscore prefix. It would still be nice to have an approved way to clear user (assigned by the developer) session data, leaving system session data (used by Django) untouched.