[Zope-Checkins] CVS: Packages/DocumentTemplate - DT_String.py:1.47 DT_Util.py:1.83
Evan Simpson
evan@zope.com
Tue, 4 Sep 2001 09:46:44 -0400
Update of /cvs-repository/Packages/DocumentTemplate
In directory cvs.zope.org:/tmp/cvs-serv6684
Modified Files:
DT_String.py DT_Util.py
Log Message:
Allow subclassing of TemplateDict
=== Packages/DocumentTemplate/DT_String.py 1.46 => 1.47 ===
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.82 => 1.83 ===
def careful_getattr(md, inst, name, default=_marker):
+
get = md.guarded_getattr
if get is None:
get = getattr
@@ -156,6 +157,7 @@
return default
def careful_hasattr(md, inst, name):
+
get = md.guarded_getattr
if get is None:
get = getattr
@@ -172,7 +174,8 @@
def namespace(self, **kw):
"""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