[Seaside] Some trouble with call & answer... I think the workflow
should continue, but it doesn't
patmaddox at me.com
Thu Aug 5 00:12:46 UTC 2010
Perfect. I had forgotten that #call returns the value given by #answer. But it makes perfect sense, and everything is peachy. Thanks Julian
On Aug 4, 2010, at 4:54 PM, Julian Fitzell wrote:
> 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).
> 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:
>> | 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:
>> 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
>> 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.
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
> seaside mailing list
> seaside at lists.squeakfoundation.org
More information about the seaside