[Zope-Checkins] CVS: Zope2 - DT_With.py:1.11.104.1

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


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

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

Use isinstance() and saved type objects consistently.



--- Updated File DT_With.py in package Zope2 --
--- DT_With.py	2000/05/11 18:54:14	1.11
+++ DT_With.py	2001/06/06 17:26:07	1.11.104.1
@@ -110,6 +110,11 @@
 
 from DT_Util import parse_params, name_param, InstanceDict, render_blocks, str
 from DT_Util import TemplateDict
+
+StringType = type('')
+TupleType = type(())
+
+
 class With:
     blockContinuations=()
     name='with'
@@ -129,11 +134,11 @@
 
     def render(self, md):
         expr=self.expr
-        if type(expr) is type(''): v=md[expr]
+        if isinstance(expr, StringType): v=md[expr]
         else: v=expr(md)
 
         if not self.mapping:
-            if type(v) is type(()) and len(v)==1: v=v[0]
+            if isinstance(v, TupleType) and len(v)==1: v=v[0]
             v=InstanceDict(v,md)
 
         if self.only: