On 4/24/06, berto <[EMAIL PROTECTED]> wrote:
> Is it possible to delete a user's session on the server?  For example,
> say I log into the admin section on a public machine and don't log out.
>  Is there a session file that I can delete on the server?  In PHP
> world, it was possible to delete the sess_* from a temp directory.  Is
> there something similar in django?

Hi Berto,

The session data is stored in your database, and you can use Django's
standard database API to access it.

In trunk, you'd do this:

    from django.models.core import sessions
    for s in sessions.get_list():
        s.delete()

In magic-removal, you'd do this:

    from django.contrib.sessions.models import Session
    for s in Session.objects.all():
        s.delete()

You can also inspect session data by playing with the session objects.
With a given session object s, use s.get_decoded() to get the session
data, which should be a Python dictionary.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to