Even more bugs in the email validator
Felix Schwarz <felix.schwarz-S0/[email protected]>
| Newsgroups | gmane.comp.python.formencode |
|---|---|
| Message-ID | <[email protected]> |
Sometimes, all bugs come at once: There is another problem in the email validator: It does not check the type of its inputs so it tries to call strip on lists etc. IMHO the email validator should be inherit from String and call the String methods before doing any checks. 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
email_typechecking.patch
(text/x-patch, 566 B)
Index: tests/test_validators.py
===================================================================
--- tests/test_validators.py (Revision 3126)
+++ tests/test_validators.py (Arbeitskopie)
@@ -127,3 +127,11 @@
else:
raise Exception("Shouldn't be valid data", values, start_values)
+def test_email_typecheck():
+ email = Email(resolve_domain=False)
+ try:
+ mail = ['']
+ email.to_python(mail)
+ raise Exception("Shouldn't be valid data", mail)
+ except Invalid, e:
+ assert 'The input must be a string' in str(e)