[Zope-Checkins] CVS: Packages/DocumentTemplate - DT_String.py:1.46.2.1 DT_Util.py:1.81.2.3

Evan Simpson evan@zope.com
Tue, 4 Sep 2001 09:45:09 -0400


Update of /cvs-repository/Packages/DocumentTemplate
In directory cvs.zope.org:/tmp/cvs-serv6493

Modified Files:
      Tag: Zope-2_4-branch
	DT_String.py DT_Util.py 
Log Message:
Allow subclasses of TemplateDict


=== Packages/DocumentTemplate/DT_String.py 1.46 => 1.46.2.1 ===
         pushed=None
         try:
-            if mapping.__class__ is TemplateDict: pushed=0
+            # Support Python 1.5.2, but work better in 2.1
+            if (mapping.__class__ is TemplateDict or
+                isinstance(mapping, TemplateDict)): pushed=0
         except: pass
 
         globals=self.globals


=== Packages/DocumentTemplate/DT_Util.py 1.81.2.2 => 1.81.2.3 ===
     """Create a tuple consisting of a single instance whose attributes are
     provided as keyword arguments."""
-    if getattr(self, '__class__', None) != TemplateDict:
+    if not (getattr(self, '__class__', None) == TemplateDict or
+            isinstance(self, TemplateDict)):
         raise TypeError,'''A call was made to DT_Util.namespace() with an
         incorrect "self" argument.  It could be caused by a product which
         is not yet compatible with this version of Zope.  The traceback