[Zope3-checkins] CVS: Zope3/src/zope/schema - _bootstrapfields.py:1.4

R. David Murray bitz@bitdance.com
Fri, 24 Jan 2003 20:58:09 -0500


Update of /cvs-repository/Zope3/src/zope/schema
In directory cvs.zope.org:/tmp/cvs-serv14524

Modified Files:
	_bootstrapfields.py 
Log Message:
Fix bare excepts in Container and Iterable, which are using try/except
to check if the field value implements iteration.  iter() will raise a
TypeError if the object is not iterable.  All tests pass, but it
is not clear to me that anything tests Container or Iterable directly.


=== Zope3/src/zope/schema/_bootstrapfields.py 1.3 => 1.4 ===
--- Zope3/src/zope/schema/_bootstrapfields.py:1.3	Thu Jan  9 09:13:18 2003
+++ Zope3/src/zope/schema/_bootstrapfields.py	Fri Jan 24 20:58:05 2003
@@ -128,7 +128,7 @@
         if not hasattr(value, '__contains__'):
             try:
                 iter(value)
-            except:
+            except TypeError:
                 raise ValidationError(errornames.NotAContainer, value)
 
 
@@ -140,7 +140,7 @@
         # See if we can get an iterator for it
         try:
             iter(value)
-        except:
+        except TypeError:
             raise ValidationError(errornames.NotAnIterator, value)