Author: ianb
Date: 2008-11-14 16:21:26 -0700 (Fri, 14 Nov 2008)
New Revision: 3655

Modified:
   FormEncode/trunk/docs/news.txt
   FormEncode/trunk/formencode/validators.py
Log:
Make FieldsMatch not require the first key be present (it would raise KeyError 
in that case)  Also fixes SF 2261391

Modified: FormEncode/trunk/docs/news.txt
===================================================================
--- FormEncode/trunk/docs/news.txt      2008-11-14 23:19:09 UTC (rev 3654)
+++ FormEncode/trunk/docs/news.txt      2008-11-14 23:21:26 UTC (rev 3655)
@@ -15,7 +15,9 @@
   domain names (like x.com).
 
 * Make :class:`formencode.validators.FieldsMatch` give a normal
-  ``Invalid`` exception if you pass it a non-dictionary.
+  ``Invalid`` exception if you pass it a non-dictionary.  Also treat
+  all missing keys as the empty string (previously the first key was
+  required and would raise KeyError).
 
 1.1
 ---

Modified: FormEncode/trunk/formencode/validators.py
===================================================================
--- FormEncode/trunk/formencode/validators.py   2008-11-14 23:19:09 UTC (rev 
3654)
+++ FormEncode/trunk/formencode/validators.py   2008-11-14 23:21:26 UTC (rev 
3655)
@@ -2648,6 +2648,8 @@
         except TypeError:
             # Generally because field_dict isn't a dict
             raise Invalid(self.message('notDict', state), field_dict, state)
+        except KeyError:
+            ref = ''
         errors = {}
         for name in self.field_names[1:]:
             if field_dict.get(name, '') != ref:


-------------------------------------------------------------------------
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-CVS mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/formencode-cvs

Reply via email to