[albatross-users] Exception: set_page() passing wrong number of parameters to page_enter()?

Dave Cole djc at object-craft.com.au
Tue May 20 11:44:44 EST 2003


>>>>> "Andrew" == Andrew McNamara <andrewm at object-craft.com.au> writes:

>>> def page_process(ctx): #ctx.set_page('myaccount') pass
>>  I seem to remember having a similar problem when I was trying to
>> use RandomModularSessionFileApp.  It's been a while, but I think
>> instead of using "ctx.set_page()" you should be using
>> "ctx.redirect()".  I'm sure you will get a more detailed
>> explanation from one of the experts, but in the meantime give the
>> redirect a try!

Andrew> I think Dan's right. There's a bug in
Andrew> RandomPageModuleMixin.page_enter, but ctx.redirect() is the
Andrew> only way to move around a RandomePage app currently.

The page_enter() method should probably be renamed as it is not
intended to be called via ctx.set_page().

In a RandomPage application the browser controls which page the
application will display.  The application just obeys the browser and
loads the requested page.  ctx.set_page() does not make sense in this
type of application.

        http://www.object-craft.com.au/projects/albatross/albatross/mixin-randpage-module.html

For RandomPageModuleMixin the page_enter() gets called every time a
page module is loaded.

For non-random page application, the page_enter() function is called
when the application changes to a new page via ctx.set_page()

        http://www.object-craft.com.au/projects/albatross/albatross/mixin-page-module.html

Andrew> RandomPageModuleMixin.page_enter should be expecting a third
Andrew> argument, the tulple of optional args to set_page.

I think we should solve the confusion by renaming the current
page_enter() method to something like page_load().  Then we would
change page_enter() to raise an exception telling you not to use
ctx.set_page() for random page applications.

- Dave

-- 
http://www.object-craft.com.au




More information about the Albatross-users mailing list