[Zope3-checkins] CVS: Zope/lib/python/ZConfig - matcher.py:1.8

Fred L. Drake, Jr. fred@zope.com
Fri, 14 Feb 2003 15:24:09 -0500


Update of /cvs-repository/Zope/lib/python/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv28569

Modified Files:
	matcher.py 
Log Message:
Make sure some additional opportunities for ValueError are converted
into ZConfig.DataConversionError.


=== Zope/lib/python/ZConfig/matcher.py 1.7 => 1.8 ===
--- Zope/lib/python/ZConfig/matcher.py:1.7	Thu Feb  6 11:45:36 2003
+++ Zope/lib/python/ZConfig/matcher.py	Fri Feb 14 15:24:08 2003
@@ -169,9 +169,13 @@
                     v = []
                     for s in values[i]:
                         if s is not None:
-                            v.append(s.getSectionDefinition().datatype(s))
-                        else:
-                            v.append(None)
+                            st = s.getSectionDefinition()
+                            try:
+                                s = st.datatype(s)
+                            except ValueError, e:
+                                raise ZConfig.DataConversionError(
+                                    e, s, (-1, -1, None))
+                        v.append(s)
                 elif ci.name == '+':
                     v = values[i]
                     for key, val in v.items():
@@ -180,7 +184,12 @@
                     v = [vi.convert(ci.datatype) for vi in values[i]]
             elif ci.issection():
                 if values[i] is not None:
-                    v = values[i].getSectionDefinition().datatype(values[i])
+                    st = values[i].getSectionDefinition()
+                    try:
+                        v = st.datatype(values[i])
+                    except ValueError, e:
+                        raise ZConfig.DataConversionError(
+                            e, values[i], (-1, -1, None))
                 else:
                     v = None
             elif name == '+':