[albatross-users] Question about session variables
Sheila King
sheila at thinkspot.net
Mon May 26 08:21:59 EST 2003
--On Sunday, May 25, 2003 12:29 AM -0700 Sheila King <sheila at thinkspot.net>
wrote:
> OK, I'm working on some session type of stuff tonight, and am
> experiencing more than the usual amount of confusion, so...in order to
> try to clarify things for myself I have to ask:
>
> Suppose on one request-cycle I do:
>
> ctx.add_session_vars('blah')
>
> Then on the next request-cycle, if I do not also save 'blah' as a session
> variable, is it removed from the session?
>
> Do I have to save whichever variables I want to have access to later each
> and every time I go through a request-cycle?
OK, first of all, I've decided that the above statements must be true.
Except for one thing.
It seems that I am losing the session variables if a bad url is called.
This means that if an authenticated user enters a bad URL, they lose their
authentication, and have to go back to the login page and login again.
(As a reminder: I'm using RandomPage modules with SessionFiles.)
I see that the load_badurl_template is called in the display_response
function in the RandomPageModuleMixin. Here is that function:
def display_response(self, ctx):
if self.__page_found:
return PageModuleMixin.display_response(self, ctx)
else:
# Display error page
ctx.write_headers()
templ = self.load_badurl_template(ctx)
ctx.set_globals(_caller_globals(3))
templ.to_html(ctx)
ctx.flush_content()
return None
And the PageModuleMixin.display_response looks like this:
def display_response(self, ctx):
if hasattr(ctx.page, 'page_display'):
ctx.write_headers()
ctx.request.end_headers()
func = getattr(ctx.page, 'page_display')
func(ctx)
ctx.flush_content()
So what I'm trying to figure out, is why is the session data being lost
when the load_badurl_template function is called? What is my best way
around this?
Thanks,
--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org
More information about the Albatross-users
mailing list