Re: validators.String validates []

Ian Bicking <[email protected]>
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
I think these issues are resolved in the trunk.  Thanks for the tests.

Felix Schwarz wrote:
> Another weird thing:
>  >>> from formencode.validators import UnicodeString, String
>  >>> String().to_python([])
> []
>  >>> UnicodeString().to_python([])
> u''
> 
> Furthermore, I think there is a bug in UnicodeString:
>  >>> UnicodeString().to_python([1, 2])
> Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
>    File "/usr/lib/python2.4/site-packages/formencode/api.py", line 368, in to_python
>      value = tp(value, state)
>    File "/usr/lib/python2.4/site-packages/formencode/validators.py", line 1069, in _to_python
>      return unicode(value, self.inputEncoding)
> TypeError: coercing to Unicode: need string or buffer, list found
> 
> As validators are often used on untrusted input, I thought that validators should only
> raise Invalid exceptions.
> 
> fs
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> FormEncode-discuss mailing list
> FormEncode-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/formencode-discuss


-- 
Ian Bicking : [email protected] : http://blog.ianbicking.org
             : Write code, do good : http://topp.openplans.org/careers

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
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.