Any validator to_python / message bug

D D <[email protected]> Wed, 25 Nov 2009 13:53:12 -0800
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
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.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

_______________________________________________
FormEncode-discuss mailing list
FormEncode-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/formencode-discuss