Hello all, 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. 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 ? Thanks! -- Steve Howe howest...@googlemail.com
_______________________________________________ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev