Re: Answer Handlers - Multiple?

"Sean P. DeNigris" <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <[email protected]>
Esteban A. Maringolo wrote
> What would be the use case of such multiple handlers?

I have a Magritte form for a Command object. I wanted to execute the command
during #save, which is implemented like this:
    ...
    self commit; answer: self model

I needed to execute after the commit but before the component answers. I
tried with an #onAnswer: block, but that prevented the normal answering, so
I ended up basically copy/pasting to:
MyModelObject>>#loginVia: aWAComponent
	"This is pretty much what #save-ing the Magritte form does, but there was
no apparent hook to set the user"
	...
	aWAComponent commit.
	self ifUserAuthenticated: [ :usr | aWAComponent session user: usr ].
	aWAComponent answer

And then:
MyModelObject>>#asComponent
	^ super asComponent 
			addValidatedForm: { [ :comp | self loginVia: comp ] -> 'Login' };
			yourself




-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Seaside-General-f86180.html
_______________________________________________
seaside mailing list
[email protected]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.