Re: Session and validate_request()

Andrew McNamara <[email protected]> Thu, 24 Mar 2005 22:19:30 +1100
Newsgroups gmane.comp.web.albatross.general
Message-ID <[email protected]>
>it seems like I'm in trouble again:)
>lets imagine I have modular random session application,

The random apps make my brain hurt, so I'm not surprised you're having
trouble.

>and initialize session variables in main script (specified as start_page
>script in application
>constructor) in validate_request() method.
>I hoped that validate_request() called on each request.
>The problem: if user have no actions for a while, session is dead
>because of session timeout.
>And if user try to request after dead session any page he gets an
>exception, because of session is dead,
>and no session variables any more. So he got no variable exception
>trace.
>
>The way to avoid this is to put check of session
>variables existence in each .py module, but this is brute force method.
>Is any smart solution already exists for this kind of problem?

The SessionServerContextMixin raises SessionExpired, which would
be caught in the top level script (around the bit that looks like
"app.run(Request())"). I would have expected this to also occur with
RandomPage apps, but I can't immediately see the code path that would
result in this happening.

Dave is the expert on the RandomPage stuff - I had hoped he would spot
your message and reply. Unfortunately, it will be Tuesday at least before
he replies - he's on leave now.

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/