Discussion:
[FE-discuss] Any validator to_python / message bug
D D
2009-11-25 21:53:12 UTC
Permalink
Hi,
I am using the PostalCode validators for my site, and wanted a custom
message if the user doesn't enter a value.

However, the 'messages' map is not working for 'empty' keyword.

Here is what is happening:

- USPostalCode is using Any( *** ) to create a validator
- "Any" is based off CompoundValidator
- CompoundValidator overrides the _to_python method of FancyValidator, and
calls the attempt_convert method
- attempt_convert calls each individual validator passed to Any

Now, the problem is, my validator is a part of a Schema.

- Schema calls to_python method of Any, so _to_python is not called at this
point
- It detects that the value is empty, and just raises an exception with a
standard missing value message

Any suggestions on what would be a correct fix for this?

Thanks,
DD.

Loading...