Opened 18 years ago

Closed 18 years ago

#3239 closed enhancement (invalid)

clear session method

Reported by: jbauer@… 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.

Change History (1)

comment:1 by Jeff Bauer <jbauer@…>, 18 years ago

Resolution: invalid
Status: newclosed

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.:

  SESSION_KEY = '_auth_user_id'
  BACKEND_SESSION_KEY = '_auth_user_backend'

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.

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