[Zope-Checkins] CVS: Zope2 - DT_Try.py:1.7.72.1

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


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

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

Use isinstance() and saved type objects consistently.



--- Updated File DT_Try.py in package Zope2 --
--- DT_Try.py	2000/06/29 14:34:19	1.7
+++ DT_Try.py	2001/06/06 17:02:59	1.7.72.1
@@ -89,6 +89,9 @@
 from DT_Util import namespace, InstanceDict
 from DT_Return import DTReturn
 
+StringType = type('')
+
+
 class Try:
     """Zope DTML Exception handling
     
@@ -224,7 +227,7 @@
         except:
             # but an error occurs.. save the info.
             t,v = sys.exc_info()[:2]
-            if type(t)==type(''):
+            if isinstance(t, StringType):
                 errname = t
             else:
                 errname = t.__name__
@@ -266,7 +269,7 @@
 
     def find_handler(self,exception):
         "recursively search for a handler for a given exception"
-        if type(exception)==type(''):
+        if isinstance(exception, StringType):
             for e,h in self.handlers:
                 if exception==e or e=='':
                     return h