Author: pjenvey
Date: 2007-05-17 21:57:17 -0600 (Thu, 17 May 2007)
New Revision: 2696

Modified:
   FormEncode/trunk/docs/Validator.txt
   FormEncode/trunk/docs/news.txt
   FormEncode/trunk/formencode/api.py
Log:
added support for Paste's MultiDict dictionary as input to
Schema.to_python, by converting it to a normal dict via MultiDict.mixed.
Previously MultiDicts wouldn't work with CompoundValidators (like
ForEach)

Modified: FormEncode/trunk/docs/Validator.txt
===================================================================
--- FormEncode/trunk/docs/Validator.txt 2007-05-16 14:49:23 UTC (rev 2695)
+++ FormEncode/trunk/docs/Validator.txt 2007-05-18 03:57:17 UTC (rev 2696)
@@ -192,11 +192,11 @@
 
 Like any other validator, a ``Registration`` instance will have the
 ``to_python`` and ``from_python`` methods.  The input should be a
-dictionary, with keys like ``"first_name"``, ``"password"``, etc.  The
-validators you give as attributes will be applied to each of the
-values of the dictionary.  *All* the values will be validated, so if
-there are multiple invalid fields you will get information about all
-of them.
+dictionary (or a Paste MultiDict), with keys like ``"first_name"``,
+``"password"``, etc.  The validators you give as attributes will be
+applied to each of the values of the dictionary.  *All* the values
+will be validated, so if there are multiple invalid fields you will
+get information about all of them.
 
 Most validators (anything that subclasses
 ``formencode.FancyValidator``) will take a certain standard set of

Modified: FormEncode/trunk/docs/news.txt
===================================================================
--- FormEncode/trunk/docs/news.txt      2007-05-16 14:49:23 UTC (rev 2695)
+++ FormEncode/trunk/docs/news.txt      2007-05-18 03:57:17 UTC (rev 2696)
@@ -6,6 +6,11 @@
 svn trunk
 ---------
 
+* Added support for Paste's MultiDict dictionary as input to
+  Schema.to_python, by converting it to a normal dict via MultiDict.mixed.
+  Previously MultiDicts wouldn't work with CompoundValidators (like
+  ForEach)
+
 * Added encoding parameter to htmlfill, which will handle cases when mixed
   str and unicode objects are used (turning all str objects into unicode)
 

Modified: FormEncode/trunk/formencode/api.py
===================================================================
--- FormEncode/trunk/formencode/api.py  2007-05-16 14:49:23 UTC (rev 2695)
+++ FormEncode/trunk/formencode/api.py  2007-05-18 03:57:17 UTC (rev 2696)
@@ -352,6 +352,9 @@
         try:
             if self.strip and isinstance(value, (str, unicode)):
                 value = value.strip()
+            elif hasattr(value, 'mixed'):
+                # Support Paste's MultiDict
+                value = value.mixed()
             if self.is_empty(value):
                 if self.not_empty:
                     raise Invalid(self.message('empty', state), value, state)


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
FormEncode-CVS mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/formencode-cvs

Reply via email to