[albatross-users] Random pages and application model

Matt Goodall matt at pollenation.net
Fri Feb 21 13:50:26 EST 2003


Gregory, thanks for the quick response.

I may be wrong but I'm fairly sure random pages **are** processed
differently. The docs certainly imply this. The interface of pages
handled by RandomPageModuleMixin has no page_leave() method and the
example (4.8 Random Access Applications) uses ctx.redirect() rather than
ctx.set_page() to transfer to another page. In fact, if I use set_page()
in a random app I get an exception.

The lifecycle of a 'normal' page is really nice - great for clearing up
session data - but I'm guessing that's hard to achieve for random pages.
It's worth noting that an <al-a href="page2"> tag on random pages is
rendered as <a href="/path/to/app.py/page2"> so Albatross is making no
attempt to "get in the way" of the request.

Cheers, Matt

On Fri, 2003-02-21 at 02:08, Gregory Bond wrote:
> 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!
> 
> 
> _______________________________________________
> Albatross-users mailing list
> Albatross-users at object-craft.com.au
> https://www.object-craft.com.au/cgi-bin/mailman/listinfo/albatross-users
-- 
Matt Goodall, Technical Director
Pollenation Internet Ltd, http://www.pollenation.net
e: matt at pollenation.net
t: 0113 2252500




More information about the Albatross-users mailing list