Re: Declaring and using a nested EditingContext
[email protected] Mon, 31 Jul 2006 20:26:06 +0200
| Newsgroups | gmane.comp.python.modeling |
|---|---|
| Message-ID | <[email protected]> |
Hi again, Thanks a lot! I am sorry for this late feedback, but I have been on = holiday :-) I will look into it as soon as I get the time and get back = to you at the earliest convenience. Best, Paul S=E9bastien Bigaret wrote: > Hi Paul & all, > = > Thanks for the detailed report. > = > Now I can see the problem. It is, in fact, not related to parent/child EC= in particular, but to a more general problem, as described at: > http://modeling.sourceforge.net/UserGuide/framework-integration-sessionin= g-ec.html > = > Just after 0.9 I posted a first patch partially correcting the problem, s= ee the post here: > http://thread.gmane.org/gmane.comp.python.modeling/374/focus=3D374 > = > I'll have some time next week-end to test it in your configuration; if yo= u find some time in the meantime to test it I'll be glad to read your exper= ience :) = > = > Thanks again for the report, and hopefully the patch will be tested enoug= h to be integrated into the framework soon. > = > Cheers, > = > -- S=E9bastien. > = > = > [email protected] a =E9crit : >> Please ignore the previous reply, it was only partly completed; I had a = >> little keyboard shortcut accident :-) >> >> Hi S=E9bastien, >> >> The test you mention run fine here, but still I get no changes in the = >> child in the following example, maybe I am doing something weird here. = >> Thanks a lot for looking into this :-) >> >> Cheers, >> Paul >> >> >> EXAMPLE >> =3D=3D=3D=3D=3D=3D=3D >> >> pymodel_parentchild.py >> ------------------------------------------------------------------------= ---- >> from Modeling.PyModel import * >> >> Association.defaults['delete'] =3D ['nullify', 'nullify'] >> Entity.defaults['properties'] =3D [] >> >> model =3D Model('parentchild', version=3D'0.1') >> model.associations =3D [] >> model.entities =3D [ >> >> Entity('Person', >> properties =3D [ >> APrimaryKey('uid', >> isClassProperty=3D0, >> isRequired=3D1, doc=3D'PK'), >> AString('first_name', width=3D60), >> AString('last_name', width=3D60), >> ], >> ), >> >> ] >> ------------------------------------------------------------------------= ---- >> >> >> Person.py >> ------------------------------------------------------------------------= ---- >> from Modeling import dynamic >> __metaclass__ =3D dynamic.CustomObjectMeta >> >> class Person: >> entityName =3D 'Person' >> mdl_define_properties =3D 1 >> ------------------------------------------------------------------------= ---- >> >> >> >> test_parentchild.py >> ------------------------------------------------------------------------= ---- >> from parentchild.Person import Person >> from Modeling.EditingContext import EditingContext as EC >> >> parent_ec =3D EC() >> child_ec =3D EC(parent_ec) >> >> def populate(ec): >> ec.insert(Person(first_name=3D'Anna', last_name=3D'Anderson')) >> >> def result(): >> global parent_ec, child_ec >> >> print "PARENT:", >> for p in parent_ec.fetch('Person'): print p.first_name, = >> p.last_name, >> print >> print "CHILD :", >> for p in child_ec.fetch('Person'): print p.first_name, p.last_n= ame, >> print >> print >> >> print "POPULATING AND SAVING CHANGES" >> populate(parent_ec) >> #parent_ec.processRecentChanges() >> parent_ec.saveChanges() >> >> result() >> >> print "CHANGING 'Anna' --> 'anna' in parent AND SAVING CHANGES" >> anna =3D parent_ec.fetch('Person', 'first_name=3D=3D"Anna"')[0] >> anna.first_name =3D 'anna' >> #parent_ec.processRecentChanges() >> parent_ec.saveChanges() >> >> result() >> ------------------------------------------------------------------------= ---- >> >> >> OUTPUT FROM TEST >> ------------------------------------------------------------ >> POPULATING AND SAVING CHANGES >> PARENT: Anna Anderson >> CHILD : Anna Anderson >> >> CHANGING 'Anna' --> 'anna' in parent AND SAVING CHANGES >> PARENT: anna Anderson >> CHILD : Anna Anderson >> ------------------------------------------------------------ >> >> >> >> >> S=E9bastien Bigaret wrote: >>> Hi Paul & all, >>> >>> [email protected] wrote: >>> [...] >>>> However, I can't quite get what is meant by the sentence: >>>> >>>> - the states of the objects in the result set will reflect any chang= es = >>>> made to them in the parent object store, even the uncommitted ones. >>>> >>>> From testing, when I change an object held by the parent EC, and then = >>>> do a fetch on that object in the child, the change is not shown in the = >>>> object held by the child EC. >>> Your understanding is correct, and the changes should appear in the chi= ld context. If they are not, it is definitely a bug. >>> >>> Could you please send me your example, where the bug appear? This is s= omething I did not observe from now on, and I'll be glad to examine and fix= it. >>> >>> Cheers, >>> >>> -- S=E9bastien. >>> >>> >>> PS: Oh, BTW, this is tested in tests/test_EditingContext_ParentChildpy,= method test_03_fetchedAndModifiedObjectsInParent() >>> >>> [email protected] a =E9crit : >>>> Hi all, >>>> >>>> I am reading chapter "5.2 Declaring and using a nested EditingContext" = >>>> in the user guide on the web: >>>> >>>> http://modeling.sourceforge.net/UserGuide/nested-ec-usage.html >>>> >>>> I understand and can verify by testing (I am using modeling release 0.= 9) = >>>> that: >>>> >>>> 1. Inserting an object in the parent EC will show up in a fetch in the = >>>> child EC. >>>> >>>> 2. Deleting an object in the parent EC deletes it from the result set = in = >>>> the child EC. >>>> >>>> However, I can't quite get what is meant by the sentence: >>>> >>>> - the states of the objects in the result set will reflect any chang= es = >>>> made to them in the parent object store, even the uncommitted ones. >>>> >>>> From testing, when I change an object held by the parent EC, and then = >>>> do a fetch on that object in the child, the change is not shown in the = >>>> object held by the child EC. >>>> >>>> Can anyone get me on the right track here? >>>> >>>> And last, but not least, thanks for all the work on this magnificent = >>>> framework :-) >>>> >>>> Cheers >>>> Paul >>>> >>>> Using Tomcat but need to do more? Need to support web services, securi= ty? >>>> Get stuff done quickly with pre-integrated technology to make your job= easier >>>> Download IBM WebSphere Application Server v.1.0.1 based on Apache Gero= nimo >>>> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&da= t=3D121642 >>>> _______________________________________________ >>>> Modeling-users mailing list >>>> [email protected] >>>> https://lists.sourceforge.net/lists/listinfo/modeling-users >>>> >>>> >> >> ------------------------------------------------------------------------- >> Using Tomcat but need to do more? Need to support web services, security? >> Get stuff done quickly with pre-integrated technology to make your job e= asier >> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geroni= mo >> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 >> _______________________________________________ >> Modeling-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/modeling-users >> >> > = ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE= VDEV