Re: Int validator passed None

Ian Bicking <[email protected]>
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
Randall Smith wrote:
> Simple issue.  I'm just starting to use FormEncode (with TurboGears). 
> The Int validator's behavior doesn't allow for None.  What is a good 
> approach for gaining this functionality.  Should I create a new 
> validator like Int that can accept None or combine existing validators 
> some how or something else?

If you pass if_empty=None to the validator, None will return None (as 
will '').  I've been thinking of changing this to default to behavior 
like this, but haven't had a chance.


-- 
Ian Bicking  |  [email protected]  |  http://blog.ianbicking.org


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.