[Seaside] "Injecting" options into a Magritte description

Esteban Lorenzano estebanlm at gmail.com
Tue Oct 1 10:38:11 UTC 2013


you want 

WACurrentRequestContext value session,

So, assuming you are using Magritte3 (and I see no reason why you shouldn't), this would be something like this:

descriptionStore: aSession
	<magritteDescription>

	^MASingleOptionDescription new
		label: 'Store';
		accessor: #store;
		beRequired;
		options: WACurrentRequestContext value session allStores;
		yourself

... or something better looking :)

Esteban

ps: the magritte list is:  smallwiki at iam.unibe.ch, but this was more a seaside question than a magritte one :)


On Oct 1, 2013, at 2:55 AM, Esteban A. Maringolo <emaringolo at gmail.com> wrote:

> I don't know if this is the proper list, but I assume most Magritte users use it for Seaside :)
> 
> Let's suppose I'm building a Seaside component by sending #asComponent to my domain model, that has one description like this:
> 
> descriptionStore
> 	<magritteDescription>
> 
> 	^MASingleOptionDescription new
> 		label: 'Store';
> 		accessor: #store;
> 		beRequired;
> 		options: Store readAll; "I want to replace this"
> 		yourself
> 
> 
> I want to replace the access to the global (Store in this case) by a collection I "inject" somehow, coming from the Seaside session in this case.
> 
> In my component I can evaluate something like "self session allStores", and that's what I'd like to inject into the creation of the description.
> 
> Is there some kind of pattern to solve this? Which also introduces some coupling with a global (Store), difficulting its testing.
> 
> 
> In the top of my mind I'm thinking of something like the following:
> 
> "in the context of a WAComponent"
> self call: (myModel asComponent: self session)
> 
> And then inject the session to something like:
> descriptionStore: aSession
> 	<magritteDescription>
> 
> 	^MASingleOptionDescription new
> 		label: 'Store';
> 		accessor: #store;
> 		beRequired;
> 		options: aSession allStores;
> 		yourself
> 
> Best regards,
> 
> Esteban A. Maringolo
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list