[Seaside] Some trouble with call & answer... I think the workflow should continue, but it doesn't

Julian Fitzell jfitzell at gmail.com
Wed Aug 4 23:54:03 UTC 2010


Hi Pat,

Use #call:, not #call:onAnswer:. #call: will return with the value
answered by the called component. #call:onAnswer: never returns (the
value answered by the component is passed into block given as the
second parameter).

Julian

On Wed, Aug 4, 2010 at 11:22 PM, Pat Maddox <patmaddox at me.com> wrote:
> I've got a basic form that calls #redeem when the submit button is pressed.  #redeem looks like this:
>
> redeem
>        | invitation |
>        invitation := ARPInvitation lookup: code.
>        invitation redeem: self requestLogin.
>        ARPInvitation remove: invitation.
>        self call: (ARPOrganizationHome newWithOrganization: invitation organization)
>
> What I'm trying to do is allow the user to redeem an invitation, but if he's not logged in then we ask for him to login.  #requestLogin is implemented as:
>
> requestLogin
>        self currentUser  "delegates to self session currentUser"
>                ifNil: [ self call: ARPLoginPage new onAnswer: [ :user | self session currentUser: user ] ].
>        ^ self currentUser
>
> and finally my login page, after the form is filled out and submitted, does
>
> login
>        self lookupLoginCredentials.
>        login ifNotNil: [ self answer: login ]
>
> I *thought* the way this works is
> 1. seaside requests the login.  User is not logged in, so it
> 2. pulls up a login page.  User logs in.  Login component returns the logged in user
> 3. #requestLogin returns the value that was answered by my login component
> 4. Processing continues on to invitation#redeem, which passes in the logged in user
>
> When I go through the workflow, it correctly logs me in, but instead of continuing on with the rest of the code in #redeem (and actually redeeming the invitation), it renders the 'redeem invitation' page again.  I can submit the form and everything goes through, because now I'm logged in.
>
> It's close to what I want, but not quite there.  What I want is when the user logs in, it automatically finishes redeeming the invitation.  Which I'm pretty sure I'm supposed to be able to do.  I'm just missing something... (is my call/answer usage wrong? am I forgetting to return something via #states?).  Thanks for any help.
>
> Pat
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


More information about the seaside mailing list