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 [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Answering myself... 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 [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
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 <[hidden email]>
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
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 <[hidden email]> > 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 > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Esteban A. Maringolo
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: [hidden email], but this was more a seaside question than a magritte one :) On Oct 1, 2013, at 2:55 AM, Esteban A. Maringolo <[hidden email]> 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 > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Esteban A. Maringolo
ah, yes... that looks better :)
And well, is the only way to do it, so I don't think is hacky: you have sessions and session-aware data... It is more a problem of understanding: your descriptions are not part of the model, are part of your view (in my apps I usually put them into a *MyView category). Esteban On Oct 1, 2013, at 3:47 AM, Esteban A. Maringolo <[hidden email]> wrote: > 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 > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by DiegoLont
Hi Diego, Thanks for the advice, I think I can replicate the WAObject methods in my own classes, and avoid subclassing it. Regarding the Memento error, it has to do with the fact the objects come from the database (GLORP).
Maybe because GLORP uses proxies. Looking for this, I found a mail from several years ago about redefining #= as: = anObject ^self == anObject yourSelf The QCMagritte name sounds familiar to me, but I really don't know what it is. Is there a blog post, presentation, website or something before looking into the code? :) The SmalltalkHub summary seems interesting.
Regards, Esteban A. Maringolo
2013/10/1 Diego Lont <[hidden email]> Hi Esteban, _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by EstebanLM
2013/10/1 Esteban Lorenzano <[hidden email]>
> > ah, yes... that looks better :) > And well, is the only way to do it, so I don't think is hacky: you have sessions and session-aware data... > It is more a problem of understanding: your descriptions are not part of the model, are part of your view (in my apps I usually put them into a *MyView category). Magritte Descriptions are part of my "metamodel". So if I want to reuse the description for a non-seaside interface, I shouldn't couple it with Seaside. But with the proper refactoring everything is doable. :) Regards! _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Esteban A. Maringolo
Hi Esteban,
I did a presentation on ESUG this year on it. The presentation should be online by now. Also it contains a demo, that explains how it is build and some of the tools it contains. It lacks a lot of tests and the documentation could be more extensive, I am working on that. But if you have questions about it, I am happy to answer you (and at the same time put them in documentation). Cheers, Diego On Oct 1, 2013, at 3:05 PM, Esteban A. Maringolo wrote:
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Thanks Diego,
I found the presentation (Dry-ing Magritte). I should take a look into it. Anybody knows if the JQueryMobile (aka JQM: http://jquerymobile.seasidehosting.st) is still operational and compatible with the latest stable version of Seaside? Plus... did ever existed a Magritte-JQM package? Thanks, Esteban A. Maringolo 2013/10/1 Diego Lont <[hidden email]>: > Hi Esteban, > > I did a presentation on ESUG this year on it. The presentation should be > online by now. Also it contains a demo, that explains how it is build and > some of the tools it contains. It lacks a lot of tests and the documentation > could be more extensive, I am working on that. But if you have questions > about it, I am happy to answer you (and at the same time put them in > documentation). > > Cheers, > Diego > > On Oct 1, 2013, at 3:05 PM, Esteban A. Maringolo wrote: > > Hi Diego, > > Thanks for the advice, I think I can replicate the WAObject methods in my > own classes, and avoid subclassing it. > > Regarding the Memento error, it has to do with the fact the objects come > from the database (GLORP). > Maybe because GLORP uses proxies. Looking for this, I found a mail from > several years ago about redefining #= as: > = anObject > ^self == anObject yourSelf > > > The QCMagritte name sounds familiar to me, but I really don't know what it > is. Is there a blog post, presentation, website or something before looking > into the code? :) The SmalltalkHub summary seems interesting. > > Regards, > > > > Esteban A. Maringolo > > > 2013/10/1 Diego Lont <[hidden email]> >> >> 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 <[hidden email]> >> > 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 >> > [hidden email] >> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >> >> _______________________________________________ >> seaside mailing list >> [hidden email] >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > > > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Esteban A. Maringolo
On Oct 1, 2013, at 3:15 PM, Esteban A. Maringolo <[hidden email]> wrote: > 2013/10/1 Esteban Lorenzano <[hidden email]> >> >> ah, yes... that looks better :) >> And well, is the only way to do it, so I don't think is hacky: you have sessions and session-aware data... >> It is more a problem of understanding: your descriptions are not part of the model, are part of your view (in my apps I usually put them into a *MyView category). > > Magritte Descriptions are part of my "metamodel". So if I want to > reuse the description for a non-seaside interface, I shouldn't couple > it with Seaside. But with the proper refactoring everything is doable. > :) Yes, that's something that I discussed several times already. By definition, Magritte can be used to describe any metamodel you want (and everybody that knows me knows that I love Magritte and I use it for almost everything) But in practice, current implementation is thought on defining GUIs, and doesn't fit (or fit badly, with forceps) into other needs. I know many people uses them as they are now also to generate JSON or XML... and looks fine but frankly, not needed (many metainformation can be inferred by the model it self, you do not need to say "this is a string", "this is an option"... that's already present). That's why for Voyage I chose to use Magritte, but define my own models (and I just have 3: reference to one, reference to many and transient). So yes, Magritte is a metamodel, but your implementation is so attached to Seaside, that I still would name it into an *View extension protocol. Esteban > > Regards! > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Esteban A. Maringolo
Hi Esteban,
There are a few of includesSubString's that need to changed if you're using Pharo2, but it appears to work fairly well (ie. I haven't tested everything, but what I am using is working well). Good luck :) Cheers, Jupiter On 02/10/2013, at 12:46 AM, "Esteban A. Maringolo" <[hidden email]> wrote: > Thanks Diego, > > I found the presentation (Dry-ing Magritte). I should take a look into it. > > Anybody knows if the JQueryMobile (aka JQM: > http://jquerymobile.seasidehosting.st) is still operational and > compatible with the latest stable version of Seaside? > Plus... did ever existed a Magritte-JQM package? > > > Thanks, > > Esteban A. Maringolo > > > 2013/10/1 Diego Lont <[hidden email]>: >> Hi Esteban, >> >> I did a presentation on ESUG this year on it. The presentation should be >> online by now. Also it contains a demo, that explains how it is build and >> some of the tools it contains. It lacks a lot of tests and the documentation >> could be more extensive, I am working on that. But if you have questions >> about it, I am happy to answer you (and at the same time put them in >> documentation). >> >> Cheers, >> Diego >> >> On Oct 1, 2013, at 3:05 PM, Esteban A. Maringolo wrote: >> >> Hi Diego, >> >> Thanks for the advice, I think I can replicate the WAObject methods in my >> own classes, and avoid subclassing it. >> >> Regarding the Memento error, it has to do with the fact the objects come >> from the database (GLORP). >> Maybe because GLORP uses proxies. Looking for this, I found a mail from >> several years ago about redefining #= as: >> = anObject >> ^self == anObject yourSelf >> >> >> The QCMagritte name sounds familiar to me, but I really don't know what it >> is. Is there a blog post, presentation, website or something before looking >> into the code? :) The SmalltalkHub summary seems interesting. >> >> Regards, >> >> >> >> Esteban A. Maringolo >> >> >> 2013/10/1 Diego Lont <[hidden email]> >>> >>> 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 <[hidden email]> >>>> 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 >>>> [hidden email] >>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >>> >>> _______________________________________________ >>> seaside mailing list >>> [hidden email] >>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >> >> >> _______________________________________________ >> seaside mailing list >> [hidden email] >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >> >> >> >> _______________________________________________ >> seaside mailing list >> [hidden email] >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >> > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |