Commit e04ad274 authored by Fred Drake's avatar Fred Drake

change port of the fix for collector issue 1203:

Python 2.3.3 doesn't need to import the types module here anymore
parent f2bb2144
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
############################################################################## ##############################################################################
__doc__='''Zope-specific versions of ZTUTils classes __doc__='''Zope-specific versions of ZTUTils classes
$Id: Zope.py,v 1.14 2004/01/27 14:39:34 tseaver Exp $''' $Id: Zope.py,v 1.15 2004/01/27 15:47:02 fdrake Exp $'''
__version__='$Revision: 1.14 $'[11:-2] __version__='$Revision: 1.15 $'[11:-2]
import sys, cgi, urllib, cgi import sys, cgi, urllib, cgi
from Tree import encodeExpansion, decodeExpansion, TreeMaker from Tree import encodeExpansion, decodeExpansion, TreeMaker
...@@ -21,7 +21,6 @@ from SimpleTree import SimpleTreeMaker ...@@ -21,7 +21,6 @@ from SimpleTree import SimpleTreeMaker
from Batch import Batch from Batch import Batch
from Products.ZCatalog.Lazy import Lazy from Products.ZCatalog.Lazy import Lazy
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
from types import StringType, ListType, IntType, FloatType
from DateTime import DateTime from DateTime import DateTime
try: try:
...@@ -36,7 +35,6 @@ except ImportError: ...@@ -36,7 +35,6 @@ except ImportError:
else: else:
from AccessControl import Unauthorized from AccessControl import Unauthorized
from types import BooleanType
class LazyFilter(Lazy): class LazyFilter(Lazy):
# A LazyFilter that checks with the security policy # A LazyFilter that checks with the security policy
...@@ -233,14 +231,14 @@ def complex_marshal(pairs): ...@@ -233,14 +231,14 @@ def complex_marshal(pairs):
k, v = pairs[i] k, v = pairs[i]
m = '' m = ''
sublist = None sublist = None
if isinstance(v, StringType): if isinstance(v, str):
pass pass
elif hasattr(v, 'items'): elif hasattr(v, 'items'):
sublist = [] sublist = []
for sk, sv in v.items(): for sk, sv in v.items():
sm = simple_marshal(sv) sm = simple_marshal(sv)
sublist.append(('%s.%s' % (k, sk), '%s:record' % sm, sv)) sublist.append(('%s.%s' % (k, sk), '%s:record' % sm, sv))
elif isinstance(v, ListType): elif isinstance(v, list):
sublist = [] sublist = []
for sv in v: for sv in v:
sm = simple_marshal(sv) sm = simple_marshal(sv)
...@@ -255,13 +253,13 @@ def complex_marshal(pairs): ...@@ -255,13 +253,13 @@ def complex_marshal(pairs):
return pairs return pairs
def simple_marshal(v): def simple_marshal(v):
if isinstance(v, StringType): if isinstance(v, str):
return '' return ''
if isinstance(v, BooleanType): if isinstance(v, bool):
return ':boolean' return ':boolean'
if isinstance(v, IntType): if isinstance(v, int):
return ':int' return ':int'
if isinstance(v, FloatType): if isinstance(v, float):
return ':float' return ':float'
if isinstance(v, DateTime): if isinstance(v, DateTime):
return ':date' return ':date'
...@@ -283,7 +281,7 @@ def url_query(request, req_name="URL", omit=None): ...@@ -283,7 +281,7 @@ def url_query(request, req_name="URL", omit=None):
if qs and omit: if qs and omit:
qsparts = qs.split('&') qsparts = qs.split('&')
if isinstance(omit, StringType): if isinstance(omit, str):
omits = {omit: None} omits = {omit: None}
else: else:
omits = {} omits = {}
......
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