I guess you can only flatten/unflatten a valid appstruct (that has been 
successfully deserialized). Invalid.asdict() returns a flat dictionary with 
error info, but I wouldn't rely on unflattening it with 
SchemaNode.unflatten().

The reason I'm interested in this question is that I needed a similar 
functionality from Invalid.asdict(). I needed error messages translated in 
it, and since they were not, I had to step through the asdict() code and 
write my own version of it. Consider this:

...
        try:
            appstruct = some_schema.deserialize(cstruct)
        except Invalid, e:
            for path in e.paths():
...

Now paths() has all the 'raw' error (fields and messages) data to 
manipulate and construct your own validation error handling mechanism.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pylons-discuss/-/6KwmorjBLSgJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to