[Twisted-Python] twisted.web session expiry

Phil Christensen phil at bubblehouse.org
Fri Aug 22 11:43:50 EDT 2008


On Aug 22, 2008, at 10:05 AM, Daniel Browne wrote:
> I need someone to help me with twisted.web.
>
> How can I do something (eg. redirect) once a users session has  
> expired? At the point when the session expires your request is  
> finished and your session is expired. I have added the notification  
> callback but I can't really do anything inside it without a session  
> to store information in or a request to redirect with, so I just  
> print a message to the console.
>
> Can anyone help me understand what I'm doing wrong here?

I can see where that would be a bit tricky.

The best idea I can think of is to have your top-level Resource check  
the session state in the locateChild method. If the session has  
expired, you can return a special Resource that simply redirects  
immediately.

-phil




More information about the Twisted-Python mailing list