Re: rough edges
Andy Altepeter <[email protected]> Wed, 30 May 2012 07:48:56 -0500
| Newsgroups | gmane.comp.web.zope.silva.devel |
|---|---|
| Message-ID | <CAC1Sm5ak0tUzP1p7SPzoH5TOmsZFQq+cKNd2UaFLwn8A0R-jjQ@mail.gmail.com> |
--===============6420953152167508300== Content-Type: multipart/alternative; boundary=14dae9398e93d3c2fe04c1405f32 --14dae9398e93d3c2fe04c1405f32 Content-Type: text/plain; charset=ISO-8859-1 Hello, > > > > Sure. zmisubformtemplate is missing a 'name' attribute. You can see my > patch here: > > https://hg.infrae.com/zeam.form.silva/rev/47b1b129f46e > > This is fixed, sorry. > Thanks! > > > Thanks for the explanation. It's sad but encouraging to hear you have > struggled with it too. The approach I took is a pattern I developed about a > year ago. I don't recall the full specifics, but I tried doing this in the > update form (replacing the subforms with a custom list) and it didn't work. > > There is not much I can do about the views. From the composed form > point of view, I could move the collection of the sub forms into a a > different method so you can override it. I will think about it, but in that > case the subforms grokkers becomes useless (meaning useless work is done). > At least the useless work is only on zope startup. Perhaps what I'm doing is a special case, and would be better suited with an abstraction layer of composedform...i.e. it seems that not all composed forms are suited to adaptation for the subforms. > > > I tried setting mode="lines" in with a schema.Tuple having a value_type > of schema.URI, and I received a componentlookuperror. I agree the > "correct" way would be to create a new widget and widget extractor for this > one thing. > > Yes, the field is available for a collection of textline. I just > registered it as well for collection of URIs (please check the trunk of > zeam.form.silva, widgets/other.py). > Ah, I back-ported this and gave it a try. The form displays fine (with textareas instead of that wierd add/remove ui), but when I click 'save' I get an error message stating "wrong contained type". This is a captured error which is displayed inline in the form. > > This is a function that is used in Products.SilvaExternalSources to log > changes using infrae.wsgi log facilities. Yes it can be used in 2.3 (3.0 > works with the same version of infrae.wsgi than 2.3, recent changes are > just to support new extensions like the alternative virtual hosting > manager). > > This is log_last_error from infrae.wsgi.log. > Nice! I'll give this a try. > > > Partly my point was to say that the Silva framework is huge and while > single apis are typically designed ok, digging through them all to find the > one pattern I'm looking for, which I need in order to test what I actually > want to test, is a pain. I disagree with the "your api sucks" comment. > Even your new functional tests have helper functions to do things that are > common in the ui (like add an object) -- does that mean your UI sucks? Or > the api layer for the browser? No, perhaps it's just a common pattern that > has an irreducible number of steps. I think the same happens in unittests. > One would hope that, as an api drifts, the tests would break and need to > be adjusted anyways... > > > > I say that, because I want my test to test my code, and not my helpers. > I am tired of fixing endless bugs, that where never detected because of > that, and that was specially true with old the test helpers provided in > Silva, I think. > > > Perhaps a better example is the old addObject helper method. I really > like that as it makes the testing code uniform and simple. I have put > copies of it in most of my test suites. > > You can still do it, in your code. The fact is for I don't think it is > much more work to call the factory, than to add methods on the test case, > and after by reading the code, I directly know what is done, and what is > tested, and don't have to juggle with multiple files, and multiple > functions or methods. > I get where you're coming from, thanks for explaining. I'd just like to live in both worlds -- where the testing framework helps you write tests (so you don't have to dig through the api so much). As the writer of most of the Silva code you do have a bit of a bias. You know what you want to test, you know what you need to set up in order to test, and you know how to write it all. Many of the things I want to test require digging in order to learn how to set up the test. Sometimes this takes a long time, and that removes much of the benefit. An example is the local sites -- yes it may be only one line of code, but in order to learn that I have to grep through ALL of the silva code for some text on the form (there are likely suspects but a person new to Silva doesn't know that; I just pray they know how to grep), read through the action for that form, dig into the api's called by that action, learn what the conditions are in order to simulate "pressing that button", and then implement it in a test. All that so I can add a service to a folder, not so I can test that functionality but because I want to test a new service as a local utility. There certainly is value in learning that but my gosh it gets tedious, especially when it is repeated frequently (and it is). In this case I skipped those tests. peace, Andy --14dae9398e93d3c2fe04c1405f32 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote"><div>Hello,</div><div>=A0</div><blockquote class= =3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd= ing-left:1ex"><div class=3D"im"> ><br> > Sure. =A0zmisubformtemplate is missing a 'name' attribute. =A0= You can see my patch here:<br> > <a href=3D"https://hg.infrae.com/zeam.form.silva/rev/47b1b129f46e" tar= get=3D"_blank">https://hg.infrae.com/zeam.form.silva/rev/47b1b129f46e</a><b= r> <br> </div> =A0 This is fixed, sorry.<br></blockquote><div><br></div><div>Thanks= !=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bord= er-left:1px #ccc solid;padding-left:1ex"> <div class=3D"im"><br> > Thanks for the explanation. =A0It's sad but encouraging to hear yo= u have struggled with it too. The approach I took is a pattern I developed = about a year ago. =A0I don't recall the full specifics, but I tried doi= ng this in the update form (replacing the subforms with a custom list) and = it didn't work.<br> <br> </div> =A0 There is not much I can do about the views. From the composed fo= rm point of view, I could move the collection of the sub forms into a a dif= ferent method so you can override it. I will think about it, but in that ca= se the subforms grokkers becomes useless (meaning useless work is done).<br= > </blockquote><div>=A0</div><div>At least the useless work is only on zope s= tartup. =A0Perhaps what I'm doing is a special case, and would be bette= r suited with an abstraction layer of composedform...i.e. it seems that not= all composed forms are suited to adaptation for the subforms.=A0</div> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> <div class=3D"im"><br> > I tried setting mode=3D"lines" in with a schema.Tuple having= a value_type of schema.URI, and I received a componentlookuperror. =A0I ag= ree the "correct" way would be to create a new widget and widget = extractor for this one thing.<br> <br> </div> =A0Yes, the field is available for a collection of textline. I just = registered it as well for collection of URIs (please check the trunk of zea= m.form.silva, widgets/other.py).<br></blockquote><div><br></div><div>Ah, I = back-ported this and gave it a try. =A0The form displays fine (with textare= as instead of that wierd add/remove ui), but when I click 'save' = =A0I get an error message stating "wrong contained type". =A0This= is a captured error which is displayed inline in the form.=A0</div> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> <div class=3D"im"><br> </div> =A0 This is a function that is used in Products.SilvaExternalSources= to log changes using infrae.wsgi log facilities. Yes it can be used in 2.3= (3.0 works with the same version of infrae.wsgi than 2.3, recent changes a= re just to support new extensions like the alternative virtual hosting mana= ger).<br> <br> =A0 This is log_last_error from infrae.wsgi.log.<br></blockquote><div>Nice= ! =A0I'll give this a try.=A0</div><blockquote class=3D"gmail_quote" st= yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div = class=3D"im"> <br> > Partly my point was to say that the Silva framework is huge and while = single apis are typically designed ok, digging through them all to find the= one pattern I'm looking for, which I need in order to test what I actu= ally want to test, is a pain. =A0I disagree with the "your api sucks&q= uot; comment. =A0Even your new functional tests have helper functions to do= things that are common in the ui (like add an object) -- does that mean yo= ur UI sucks? =A0Or the api layer for the browser? =A0No, perhaps it's j= ust a common pattern that has an irreducible number of steps. =A0I think th= e same happens in unittests. =A0One would hope that, as an api drifts, the = tests would break and need to be adjusted anyways...<br> ><br> <br> </div> =A0I say that, because I want my test to test my code, and not my he= lpers. I am tired of fixing endless bugs, that where never detected because= of that, and that was specially true with old the test helpers provided in= Silva, I think.<br> <div class=3D"im"><br> > Perhaps a better example is the old addObject helper method. I really = like that as it makes the testing code uniform and simple. =A0I have put co= pies of it in most of my test suites.<br> <br> </div> =A0You can still do it, in your code. The fact is for I don't th= ink it is much more work to call the factory, than to add methods on the te= st case, and after by reading the code, I directly know what is done, and w= hat is tested, and don't have to juggle with multiple files, and multip= le functions =A0or methods.<br> </blockquote><div><br></div><div>I get where you're coming from, thanks= for explaining. =A0I'd just like to live in both worlds -- where the t= esting framework helps you write tests (so you don't have to dig throug= h the api so much). =A0As the writer of most of the Silva code you do have = a bit of a bias. =A0You know what you want to test, you know what you need = to set up in order to test, and you know how to write it all.</div> <div><br></div><div>Many of the things I want to test require digging in or= der to learn how to set up the test. =A0Sometimes this takes a long time, a= nd that removes much of the benefit. =A0An example is the local sites -- ye= s it may be only one line of code, but in order to learn that I have to gre= p through ALL of the silva code for some text on the form (there are likely= suspects but a person new to Silva doesn't know that; I just pray they= know how to grep), read through the action for that form, dig into the api= 's called by that action, learn what the conditions are in order to sim= ulate "pressing that button", and then implement it in a test. = =A0All that so I can add a service to a folder, not so I can test that func= tionality but because I want to test a new service as a local utility. =A0T= here certainly is value in learning that but my gosh it gets tedious, espec= ially when it is repeated frequently (and it is). =A0In this case I skipped= those tests.</div> <div><br></div><div>peace,</div><div>Andy</div></div> --14dae9398e93d3c2fe04c1405f32-- --===============6420953152167508300== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ silva-dev mailing list silva-dev-IAPFreCvJWM6s/[email protected] https://lists.infrae.com/mailman/listinfo/silva-dev --===============6420953152167508300==--