Bug in the Email validator?
"Pierre Ruyssen" <[email protected]> Fri, 31 Oct 2008 09:57:24 +0100
| Newsgroups | gmane.comp.python.formencode |
|---|---|
| Message-ID | <[email protected]> |
Hi, I'm currently using Formencode, and thx for the work done! One problem I have seen is that if you create a formencode.validators.Email(strip=True, resolve_domain=True) and then you try to validate an email containing a "_", it fails with a UnicodeDecodeError. It seems to me that the strip method converts the value in unicode, and that pyDNS is expecting a str. It would be better if pyDNS accepted Unicode, but in my opinion, Formencode should intercept any error made during validation and say something like "this value is not correct". What do you think? Thanks, Pierre Here is the stack of the error: File '/usr/lib/python2.5/site-packages/FormEncode-1.1-py2.5.egg/formencode/api.py', line 400 in to_python value = tp(value, state) File '/usr/lib/python2.5/site-packages/FormEncode-1.1-py2.5.egg/formencode/schema.py', line 153 in _to_python new[name] = validator.to_python(value, state) File '/usr/lib/python2.5/site-packages/FormEncode-1.1-py2.5.egg/formencode/api.py', line 403 in to_python vp(value, state) File '/usr/lib/python2.5/site-packages/FormEncode-1.1-py2.5.egg/formencode/validators.py', line 1352 in validate_python a=DNS.DnsRequest(domain, qtype='mx').req().answers File 'build/bdist.linux-i686/egg/DNS/Base.py', line 202 in req File 'build/bdist.linux-i686/egg/DNS/Lib.py', line 461 in addQuestion File 'build/bdist.linux-i686/egg/DNS/Lib.py', line 128 in addname UnicodeDecodeError: 'ascii' codec can't decode byte 0x99 in position 0: ordinal not in range(128) ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ FormEncode-discuss mailing list FormEncode-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/formencode-discuss