[Zope-Checkins] CVS: Zope2 - DT_String.py:1.39.16.1

fred@digicool.com fred@digicool.com
Wed, 6 Jun 2001 12:59:03 -0400 (EDT)


Update of /cvs-repository/Zope2/lib/python/DocumentTemplate
In directory korak.digicool.com:/tmp/cvs-serv12544

Modified Files:
      Tag: zope-2_3-branch
	DT_String.py 
Log Message:

Use isinstance() and saved type objects consistently.



--- Updated File DT_String.py in package Zope2 --
--- DT_String.py	2000/12/12 21:20:25	1.39
+++ DT_String.py	2001/06/06 16:59:03	1.39.16.1
@@ -91,6 +91,8 @@
 from DT_Var import Var, Call, Comment
 from DT_Return import ReturnTag, DTReturn
 
+TupleType = type(())
+
 _marker = []  # Create a new marker object.
 
 class String:
@@ -165,9 +167,9 @@
             , regex.casefold) 
 
     _parseTag__roles__=()
-    def _parseTag(self, tagre, command=None, sargs='', tt=type(())):
+    def _parseTag(self, tagre, command=None, sargs='', tt=TupleType):
         tag, args, command, coname = self.parseTag(tagre,command,sargs)
-        if type(command) is tt:
+        if isinstance(command, tt):
             cname, module, name = command
             d={}
             try:
@@ -502,7 +504,7 @@
                 push(mapping)
             md.validate=self.validate
             if client is not None:
-                if type(client)==type(()):
+                if isinstance(client, TupleType):
                     md.this=client[-1]
                 else: md.this=client
             pushed=0
@@ -513,7 +515,7 @@
         md.level=level+1
 
         if client is not None:
-            if type(client)==type(()):
+            if isinstance(client, TupleType):
                 # if client is a tuple, it represents a "path" of clients
                 # which should be pushed onto the md in order.
                 for ob in client: