Author: ianb
Date: 2007-10-17 11:17:52 -0600 (Wed, 17 Oct 2007)
New Revision: 3083

Modified:
   FormEncode/trunk/formencode/api.py
Log:
typo, and also treat empty lists/tuple/dict as 'empty'

Modified: FormEncode/trunk/formencode/api.py
===================================================================
--- FormEncode/trunk/formencode/api.py  2007-10-16 17:57:32 UTC (rev 3082)
+++ FormEncode/trunk/formencode/api.py  2007-10-17 17:17:52 UTC (rev 3083)
@@ -406,7 +406,7 @@
                 if fp:
                     value = fp(value, state)
                 vo = self.validate_other
-                if vo and co is not self._validate_noop:
+                if vo and vo is not self._validate_noop:
                     vo(value, state)
                 return value
             else:
@@ -424,7 +424,8 @@
 
     def is_empty(self, value):
         # None and '' are "empty"
-        return value is None or value == ''
+        return value is None or value == '' or (
+            isinstance(value, (list, tuple, dict)) and not value)
 
     def empty_value(self, value):
         return None


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

Reply via email to