The validator is modifying the cstruct dict.

My understanding about after_bind is that it's to set configuration
parameters for the validators; i.e., control values to check against,
not the deserialized data directly.

On Tue, Dec 10, 2013 at 10:00 PM, Vincent Catalano
<[email protected]> wrote:
> How are you trying to modify the data? You could use the 'after_bind'
> callback function.
>
> On Dec 10, 2013 6:31 PM, "Mike Orr" <[email protected]> wrote:
>>
>> Can a Colander validator modify data? I assumed it could because
>> FormEncode does, but my tests show the cstruct isn't changing.
>>
>> class SearchSchema(MappingSchema):
>>     ....
>>     start = SchemaNode(Date(), missing=None)
>>     end = SchemaNode(Date(), missing=None)
>>
>>     def validate(self, node, cstruct):
>>         """Reverse start and end dates if out of order."""
>>         start = cstruct["start"]
>>         end = cstruct["end"]
>>         if start and end and start > end:
>>             cstruct["start"], cstruct["end"] = end, start
>>
>> Otherwise, the only way to modify data seems to be in the type
>> objects, but that won't work for this because its scope is a single
>> field.
>>
>> --
>> Mike Orr <[email protected]>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pylons-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/pylons-discuss.
>> For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/pylons-discuss.
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
Mike Orr <[email protected]>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to