[Zope-Checkins] CVS: Zope2 - DT_InSV.py:1.17.104.2
fred@digicool.com
fred@digicool.com
Wed, 6 Jun 2001 12:57:15 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/python/DocumentTemplate
In directory korak.digicool.com:/tmp/cvs-serv12498
Modified Files:
Tag: zope-2_3-branch
DT_InSV.py
Log Message:
Use isinstance() and saved type objects consistently.
--- Updated File DT_InSV.py in package Zope2 --
--- DT_InSV.py 2001/01/16 22:58:20 1.17.104.1
+++ DT_InSV.py 2001/06/06 16:57:15 1.17.104.2
@@ -90,6 +90,7 @@
from string import lower, rfind, split, join
from math import sqrt
+IntType=type(1)
TupleType=type(())
try:
import Missing
@@ -120,9 +121,9 @@
def letter(self,index): return chr(ord('a')+index)
def Letter(self,index): return chr(ord('A')+index)
def key(self,index): return self.items[index][0]
- def item(self,index, tt=type(())):
+ def item(self,index, tt=TupleType):
i=self.items[index]
- if type(i) is tt and len(i)==2: return i[1]
+ if isinstance(i, tt) and len(i)==2: return i[1]
return i
def roman(self,index): return lower(self.Roman(index))
@@ -177,7 +178,7 @@
def value(self,index,name):
data=self.data
item=self.items[index]
- if type(item)==TupleType and len(item)==2:
+ if isinstance(item, TupleType) and len(item)==2:
item=item[1]
if data['mapping']: return item[name]
return getattr(item,name)
@@ -241,7 +242,7 @@
try:
if item is mv:
item = None
- if type(item)==type(1):
+ if isinstance(item, IntType):
s=item*long(item)
else:
s=item*item