Commit 88a1abe6 authored by Evan Simpson's avatar Evan Simpson

Support Python 2.3 BooleanType in ZTUtils.

parent cd2bdf3d
......@@ -15,6 +15,9 @@ Zope Changes
(such as storages, databases, or logging handlers) to be used.
Bugs fixed
- Python 2.3 BooleanType wasn't handled properly by ZTUtils
marshalling and ZPublisher's converters.
- Collector #1065: bin/ scripts didn't export HOME envars.
- Collector #572: WebDAV GET protected by 'FTP Access' permission.
......
......@@ -10,7 +10,7 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
__version__='$Revision: 1.23 $'[11:-2]
__version__='$Revision: 1.24 $'[11:-2]
import re
from types import ListType, TupleType, UnicodeType
......@@ -101,7 +101,6 @@ def field2lines(v):
return field2text(v).split('\n')
def field2date(v):
v = field2string(v)
try:
v = DateTime(v)
......@@ -118,6 +117,8 @@ def field2date_international(v):
return v
def field2boolean(v):
if v == 'False':
return not 1
return not not v
class _unicode_converter:
......
......@@ -12,8 +12,8 @@
##############################################################################
__doc__='''Zope-specific versions of ZTUTils classes
$Id: Zope.py,v 1.12 2003/07/03 21:44:59 caseman Exp $'''
__version__='$Revision: 1.12 $'[11:-2]
$Id: Zope.py,v 1.13 2003/10/24 20:16:08 evan Exp $'''
__version__='$Revision: 1.13 $'[11:-2]
import sys, cgi, urllib, cgi
from Tree import encodeExpansion, decodeExpansion, TreeMaker
......@@ -36,6 +36,12 @@ except ImportError:
else:
from AccessControl import Unauthorized
# Support pre-Python 2.3 :-(
try:
from types import BooleanType
except ImportError:
BooleanType = None
class LazyFilter(Lazy):
# A LazyFilter that checks with the security policy
......@@ -255,6 +261,8 @@ def complex_marshal(pairs):
def simple_marshal(v):
if isinstance(v, StringType):
return ''
if BooleanType and isinstance(v, BooleanType):
return ':boolean'
if isinstance(v, IntType):
return ':int'
if isinstance(v, FloatType):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment