[Zope3-checkins] CVS: Packages/SFTPGateway/src/ZConfig - datatypes.py:1.19

Fred L. Drake, Jr. fred at zope.com
Mon Dec 29 15:44:14 EST 2003


Update of /cvs-repository/Packages/SFTPGateway/src/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv11226

Modified Files:
	datatypes.py 
Log Message:
make the "identifier" datatype always convert values to 8-bit strings


=== Packages/SFTPGateway/src/ZConfig/datatypes.py 1.18 => 1.19 ===
--- Packages/SFTPGateway/src/ZConfig/datatypes.py:1.18	Sun Dec 28 20:13:48 2003
+++ Packages/SFTPGateway/src/ZConfig/datatypes.py	Mon Dec 29 15:43:43 2003
@@ -22,8 +22,10 @@
     unicode
 except NameError:
     StringTypes = type(''), type(unicode(''))
+    UnicodeType = StringTypes[1]
 else:
     StringTypes = type(''),
+    UnicodeType = None
 
 try:
     True
@@ -109,6 +111,12 @@
 class IdentifierConversion(RegularExpressionConversion):
     def __init__(self):
         RegularExpressionConversion.__init__(self, "[_a-zA-Z][_a-zA-Z0-9]*")
+
+    def __call__(self, value):
+        value = RegularExpressionConversion.__call__(self, value)
+        if UnicodeType is not None and isinstance(value, UnicodeType):
+            value = value.encode("ascii")
+        return value
 
 
 def integer(value):




More information about the Zope3-Checkins mailing list