The values are changing from strings to date objects, and if I put a
self.raise_invalid() in the method it raises it. Am I supposed to
'return True' from the method or something?

On Wed, Dec 11, 2013 at 10:33 AM, Vincent Catalano
<[email protected]> wrote:
> Ah, it appears you are correct.
>
> Are you sure your validate method is being called? After reviewing some of
> my code where I change data using the colander validate method, it seems
> that your code should work.
>
> -Vincent
>
>
>
>
> On Tue, Dec 10, 2013 at 11:23 PM, Mike Orr <[email protected]> wrote:
>>
>> 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.
>
>
>
>
> --
> Vincent Catalano
> Software Engineer and Web Ninja,
> (520).603.8944
>
> --
> 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