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

Sheila King sheila at thinkspot.net
Tue May 20 17:01:38 EST 2003


--On Monday, May 19, 2003 3:46 PM -0500 Dan Bergan <danb at champonline.com> 
wrote:

> Sheila King wrote:
>
>> def page_process(ctx):
>>    # ctx.set_page('myaccount')
>>    pass
>
> Sheila,
>
> 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!
>

OK, thanks Dan. I do see that on page 58 of the pdf manual, they are 
showing ctx.redirect for page processing in an example with a RandomPage 
module.

OK, I have tried that now (it bothers me a bit, though, as I don't really 
want to be sending a 301 code to the browser for what is merely the results 
of processing a cgi request. :/ ).

OK, so I have in the login.py page module the following:

def page_display(ctx):
    ctx.load_template('commonmacros.html')
    ctx.run_template('login.html')

def page_process(ctx):
    ctx.redirect_url('myaccount')

(Mind you, that in a later version there will be much more to the 
page_process function, but for now I am merely trying to test out some 
things so keeping it simple.)

And in the myaccount.py module I have this:

def page_display(ctx):
    ctx.load_template('commonmacros.html')
    ctx.run_template('myaccount.html')

And the app has login as the "start" page. But now when I go to the 
application, it jumps straight the the "myaccount" page, which I do not 
understand, as that is supposed to be called on "page_process" for login 
(the start page), and I figured that required using the submit button. But 
I never even get an opportunity to view the login page now, and press the 
submit button. It just jumps me straight to the myaccount page.

Here is what I want to do:

(1) I want "login" to be the start page. Whenever someone starts a new 
session or doesn't specify a page in the URL, they should end up there, at 
the "login" page. (I had this much working before I tried to add a second 
page.)

(2) When the form on the "login" page is submitted, some processing will 
occur and if the login request is valid (which I will test for) then they 
will need to go to the "myaccount" page. Seemed to me that this needed to 
be in the page_process function for "login" module? Am I incorrect there?

I was also having some macro errors with the myaccount page, but I just 
took the macros out, eventually, and put plain HTML into the myaccount.html 
page, to reduce at least one of the errors for now.


-- 
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org




More information about the Albatross-users mailing list