[Zope-Checkins] CVS: Zope2 - DT_Var.py:1.37.42.1
fred@digicool.com
fred@digicool.com
Wed, 6 Jun 2001 13:24:51 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/python/DocumentTemplate
In directory korak.digicool.com:/tmp/cvs-serv12702
Modified Files:
Tag: zope-2_3-branch
DT_Var.py
Log Message:
Require Python 1.5.2: just expect sys.exc_info() to be there.
Convert a string to an int using int() instead of string.atoi().
--- Updated File DT_Var.py in package Zope2 --
--- DT_Var.py 2000/09/05 22:03:12 1.37
+++ DT_Var.py 2001/06/06 17:24:50 1.37.42.1
@@ -222,9 +222,10 @@
from DT_Util import parse_params, name_param, html_quote, str
import regex, string, sys, regex
-from string import find, split, join, atoi, rfind
+from string import find, split, join, rfind
from urllib import quote, quote_plus
+
class Var:
name='var'
expr=None
@@ -283,7 +284,6 @@
if have_arg('null') and not val and val != 0:
# check for null (false but not zero, including None, [], '')
return args['null']
-
# handle special formats defined using fmt= first
if have_arg('fmt'):
@@ -297,8 +297,7 @@
elif fmt=='': val=''
else: val = fmt % val
except:
- t, v= sys.exc_type, sys.exc_value
- if hasattr(sys, 'exc_info'): t, v = sys.exc_info()[:2]
+ t, v = sys.exc_info()[:2]
if val is None or not str(val): return args['null']
raise t, v
@@ -322,7 +321,7 @@
if have_arg('size'):
size=args['size']
- try: size=atoi(size)
+ try: size=int(size)
except: raise 'Document Error',(
'''a <code>size</code> attribute was used in a <code>var</code>
tag with a non-integer value.''')