Re: validators.String validates []
Felix Schwarz <felix.schwarz-S0/[email protected]>
| Newsgroups | gmane.comp.python.formencode |
|---|---|
| Message-ID | <[email protected]> |
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/