[Seaside] "Injecting" options into a Magritte description
diego.lont at delware.nl
Tue Oct 1 07:24:02 UTC 2013
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:
((Smalltalk at: #ConfigurationOfQCMagritte) project version: '0.1') load: 'Demo'.
(Smalltalk at: #ZnZincServerAdaptor) startOn: 8080. "only if seaside is not started yet"
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:
> ^MASingleOptionDescription new
> label: 'Store';
> accessor: #store;
> options: self currentSession allStores;
> ^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.
> seaside mailing list
> seaside at lists.squeakfoundation.org
More information about the seaside