[Seaside] "Injecting" options into a Magritte description

Diego Lont diego.lont at delware.nl
Tue Oct 1 07:24:02 UTC 2013


Hi Esteban,

I have a similar solution in QC Magritte, that allows the session to be acquired from the objects as well. I use it for my rights, as my user is in my session. As you can see in the seaside implementation WAObject already implements request-context, session and application. I do recommend that you use an indirection, that you put in your description "self allStores" and implement the allStores as "self session allStores". But other than that I think the solution is sound.

As for the validation error. From what you have written here I have no clue what the problem is. In Magritte the memento stores an original value. If the original value is not exactly the same as the value of the model, it gives a validation error. Maybe you can put a halt here and find out what the difference is. Maybe you recreate a certain object (return a copy) that causes the difference? 

If you need a more dynamic solution (with updating values), please take a look at QCMagritte. It can be found at smalltalkhub, and loaded by:

Gofer new
	url: 'http://smalltalkhub.com/mc/DiegoLont/QCMagritte/main';
	package: 'ConfigurationOfQCMagritte';
	load.

((Smalltalk at: #ConfigurationOfQCMagritte) project version: '0.1') load: 'Demo'.

(Smalltalk at: #ZnZincServerAdaptor) startOn: 8080. "only if seaside is not started yet"


Cheers,
Diego

On Oct 1, 2013, at 4:51 AM, Esteban A. Maringolo wrote:

> I don't know whether it has to do with my previous solution. But now I'm getting a 'Input is conflicting with concurrent modification'  validation error, when there is no concurrent use (it is just me using the app).
> 
> The model I'm editing has only two attributes: #time and #store, and I'm not changing #store, even if I don't change anything I get the same error.
> 
> Any clues?
> 
> Esteban A. Maringolo
> 
> 
> 2013/9/30 Esteban A. Maringolo <emaringolo at gmail.com>
> Answering myself...
> 
> Maybe not an elegant solution (nor a scalable one) but I found I can use the dynamic variable scoping to access the current session.
> 
> I changed my description to use:
> 
> descriptionStore
> 	<magritteDescription>
> 
> 	^MASingleOptionDescription new
> 		label: 'Store';
> 		accessor: #store;
> 		beRequired;
> 		options: self currentSession allStores;
> 		yourself
> 
> 
> #currentSession
>     ^WACurrentRequestContext value session
> 
> 
> It still smells bad, for some reason DynamicVariable's seems "hacky" to me. 
> 
> Maybe they're more clever than what I'm used to.
> 
> Regards,
> 
> 
> Esteban.
> 
> 
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list