This also got worked out on IRC; it turned out the problem that was suspected and reported did not exist.
On 4/4/10 8:10 AM, Tres Seaver wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > (forgot to CC the list). > > > Steve Howe wrote: > >> I stepped upon Colander a few days ago in PyPI, and I like it's concept and >> functionality. I have developed something very similar for internal use in >> my company, not as polished however. >> >> But I think a key functionality is missing from Colander: mapping between >> user interface control and data model. > > Hmm, I'm not quite sure how the "data model" ties in here: Colander > doesn't pretend to know about anything but the "schema", which is about > the serialization format more than any backing store you might be using > (ZODB, SQL, XML, whatever). > >> Suppose your data comes from a web >> form, and you have a series of repeated fields that map to the same logical >> field in your deserialized data, and you want to validate, then show >> possible errors back to the user. You'll have the field names and message >> errors. Ex: >> >> Data model: >> >> <form> >> <name>Steve Howe</name> >> <address> >> <street>Av. X</street> >> <number></number> >> <city></city> >> <address> >> <street>Av. Y</street> >> <number></number> >> <city></city> >> </address> >> </form> >> >> ...e so forth. >> >> Form model: >> >> <name/> >> <address1.street/> >> <address1.number/> >> <address1.city/> >> <address2.street/> >> <address2.number/> >> <address2.city/> >> >> If number for second<address> is wrong, Colander would report something >> like this: >> >> Invalid: {'number': 'Number is invalid'} >> >> In the case of a detected error, how do you plan to report that back to the >> user interface (i.e. the web form)? As you can see, there's no simple way to >> map form.address[0].number<-> address1.number. >> >> In my mentioned internal validation framework, I send a dictionary to the >> server, such as {'field': 'address', 'value': 'Av. X', 'id': 'street2'} (id >> being the form control "name" property) and thus I'll keep a reference to >> the original source the data came from. Being a dictionary, it's extensible >> in case I need to send even more data (then just "name", "value") to the >> server . >> >> How do you deal with this kind of situation ? > > The docs show an error dict in the exception raised by the schema: > > http://docs.repoze.org/colander/#deserializing-an-invalid-serialization > > Note that the field name for each error is present as the key in that > dictionary. > > > > Tres. > - -- > =================================================================== > Tres Seaver +1 540-429-0999 tsea...@palladion.com > Palladion Software "Excellence by Design" http://palladion.com > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAku4gbsACgkQ+gerLs4ltQ6c6ACglnqc5++V2C33QSjZ3oP925rn > 1GoAmwSUrqnBYwIXQAABPOxpLCj2L/9m > =h3zU > -----END PGP SIGNATURE----- > _______________________________________________ > Repoze-dev mailing list > Repoze-dev@lists.repoze.org > http://lists.repoze.org/listinfo/repoze-dev > -- Chris McDonough Agendaless Consulting, Fredericksburg VA The repoze.bfg Web Application Framework Book: http://bfg.repoze.org/book _______________________________________________ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev