[Seaside] [NEWBIES] How to set up a multi-page website

Ramon Leon ramon.leon at allresnet.com
Sat Apr 26 00:24:49 UTC 2008

> wow, this shouldn't be that hard to figure out, but, I can't 
> seem to be able to change the value of wantsLogin( the 
> variable I am using, should be self explanatory) from my 
> prototype menu component, so, I can't get to the login 
> component, what am i doing? 
> MenuComponent>>renderConentOn: html
>      html anchor callback: [self session wantsLogin: true]; 
> with: [html text: 'login']
> RootTask>>go
>     [ self session wantsLogin ]
>         whileTrue: [Transcript show: 'wantsLogin = true'; cr. 
> self call: self loginComponent].
>     Transcript show: 'wantsLogin = false'; cr. self call: 
> self menuComponent

Your logic seems a bit backwards here.  By the time your menu component is
shown and has the chance to modify wantsLogin, you're past the login.  To
make it work, you need to restart the task by answering from the menu.

 html anchor callback: [self session wantsLogin: true. self answer]; with:

So the menu component returns control of the UI back to the Task, which will
then restart.  If you're going to force a login, probably better to stick
the user on the session and have the task check for a nil user instead, then
the login form need just set a current user on the session.  

I usually use a null object pattern here and have a special null user so I
can delegate to the current user (whether logged in or out) to find out what
actions are available.  For example, login is a valid action for a null user
while logout is a valid action for any other user.

Ramon Leon

More information about the seaside mailing list