[Seaside] Task Loop

Julian Fitzell julian at beta4.com
Sat Mar 25 01:12:20 UTC 2006


I think it only repeats if the WATask is the root controller (ie. if it 
has nothing to #answer: to).  If it does have something to answer to, 
then the context is going to jump out of that block and back to the 
caller and thus the loop will never happen.  The looping in WATask is 
really just there as an odd special case that can be useful when testing 
or developing with a WATask as the root.  The task is not intended to 
loop in the general case.

If you want looping behaviour, just write it in the #go method like you 
would for any other function:

go
   [self isWorkSuccessful] whileFalse:
     [self getSomeUserInput.
      self doSomeWork]]

Or whatever... you get the idea.

Julian

Zulq Alam wrote:
> Hi, I'm a bit confused by WATask, maybe you can help me please?
> 
> When implementing #renderConentOn in WAComponent I know that if I don't 
> send self #answer that WAComponent will remain visible (assuming I don't 
> call anything else).
> 
> This is not the same with a WATask which answers automatically when #go 
> terminates.
> 
> I would like to have a WATask subclass that does the following.
> 
>    1) Call a WAComponent which has a form to collect some information. 
> This WAComponent will only answer if all the fields are syntactically 
> valid.
>    2) Using the inputs from the component called in (1) perform some work.
>    3) If this work fails (i.e. the inputs were semantically invalid) 
> start from (1).
> 
> I was expecting this to happen without looping in #go.
> 
> An alternative to looping would be to have the view call the task rather 
> than answer to the task but I think this breaks the encapsulation of the 
> task.
> 
> I though I might find some answers in WATask...
> 
> renderContentOn: html
>    self session redirectTo: (html urlForAction: [[self answer: self go] 
> repeat])
> 
> This looks like it wants to loop to me! If not, what's the #repeat for?
> 
> So, I'm quite confused now.
> 
> Thanks,
> Zulq.
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


More information about the Seaside mailing list