[Zodb-checkins] CVS: Packages/ZConfig - Config.py:1.14.10.2 datatypes.py:1.1.2.2
Fred L. Drake, Jr.
fred@zope.com
Wed, 11 Dec 2002 15:02:26 -0500
Update of /cvs-repository/Packages/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv19518
Modified Files:
Tag: zconfig-schema-devel-branch
Config.py datatypes.py
Log Message:
- Move asBoolean again, under the expectation that the ZConfig.Config module
may be removed.
- Rename datatypes to match the most-similar datatypes from XSD.
=== Packages/ZConfig/Config.py 1.14.10.1 => 1.14.10.2 ===
--- Packages/ZConfig/Config.py:1.14.10.1 Tue Dec 10 11:09:12 2002
+++ Packages/ZConfig/Config.py Wed Dec 11 15:02:25 2002
@@ -2,6 +2,8 @@
import ZConfig
+from ZConfig.datatypes import asBoolean
+
try:
True
except NameError:
@@ -190,14 +192,3 @@
return default
else:
return s.split()
-
-
-def asBoolean(s):
- """Convert a string value to a boolean value."""
- ss = str(s).lower()
- if ss in ('yes', 'true', 'on'):
- return True
- elif ss in ('no', 'false', 'off'):
- return False
- else:
- raise ValueError("not a valid boolean value: " + repr(s))
=== Packages/ZConfig/datatypes.py 1.1.2.1 => 1.1.2.2 ===
--- Packages/ZConfig/datatypes.py:1.1.2.1 Tue Dec 10 14:17:55 2002
+++ Packages/ZConfig/datatypes.py Wed Dec 11 15:02:25 2002
@@ -106,8 +106,20 @@
RegularExpressionConversion.__init__(self, "[_a-zA-Z][_a-zA-Z0-9]*")
+def asBoolean(s):
+ """Convert a string value to a boolean value."""
+ ss = str(s).lower()
+ if ss in ('yes', 'true', 'on'):
+ return True
+ elif ss in ('no', 'false', 'off'):
+ return False
+ else:
+ raise ValueError("not a valid boolean value: " + repr(s))
+
+
stock_datatypes = {
- "int": TrivialConversion(int),
+ "boolean": TrivialConversion(asBoolean),
+ "integer": TrivialConversion(int),
"float": TrivialConversion(float),
"str": TrivialConversion(str),
"locale": MemoizedConversion(Locale().convert),