[albatross-users] Random pages and application model
Gregory Bond
gnb at itga.com.au
Fri Feb 21 13:08:52 EST 2003
matt at pollenation.net said:
> >From debug traces I see the following sequence whenever the page is
> requested:
> page_enter(ctx)
> page_process(ctx)
> page_display(ctx)
It's a bit more subtle than that.
Each albatross app has a concept of the "current page" (which is available in
ctx.locals.__page__). When a session is initiated, the current page is set to
the start page specified in the application object.
When the current page is moved (either by a redirect or a set_page()), then
page_leave() is called for the old page, and then page_enter() is called for
the new page.
Page_display() is called to display a page (der!) and may not necessarily be
called in conjunction with anything else (e.g. if the user hits "refresh").
When the user submits a form, then page_proces() is called. If page_process()
calls set_page(), then page_leave() and page_enter() will be called. But it
is perfectly valid for page_process() not to change the current page, in which
case page_leave() and page_enter() will not be called.
One subtlety is that the page_enter() may be called from within the
page_process() routine. I.e. the call graph might look like:
application.run()
application.process_request()
old.page_process()
ctx.set_page('new')
old.page_leave()
new.page_enter()
application.display_response()
new.page_display()
IIUC, the Random mixins work the same way as the non-Random versions as far as
all this is concerned. I hope that makes it clearer!
More information about the Albatross-users
mailing list