[Zope-Checkins] CVS: Zope/lib/python/DocumentTemplate - DT_Var.py:1.41.2.2

Shane Hathaway shane@digicool.com
Tue, 2 Oct 2001 10:24:47 -0400


Update of /cvs-repository/Zope/lib/python/DocumentTemplate
In directory cvs.zope.org:/tmp/cvs-serv13616

Modified Files:
      Tag: Zope-2_4-branch
	DT_Var.py 
Log Message:
Merged Hotfix_2001-09-28

=== Zope/lib/python/DocumentTemplate/DT_Var.py 1.41.2.1 => 1.41.2.2 ===
         # handle special formats defined using fmt= first
         if have_arg('fmt'):
+            _get = getattr(md, 'guarded_getattr', None)
+            if _get is None:
+                _get = getattr
+
             fmt=args['fmt']
             if have_arg('null') and not val and val != 0:
                 try:
                     if hasattr(val, fmt):
-                        val = getattr(val,fmt)()
+                        val = _get(val, fmt)()
                     elif special_formats.has_key(fmt):
                         val = special_formats[fmt](val, name, md)
                     elif fmt=='': val=''
@@ -308,7 +312,7 @@
                 # We duplicate the code here to avoid exception handler
                 # which tends to screw up stack or leak
                 if hasattr(val, fmt):
-                    val = getattr(val,fmt)()
+                    val = _get(val, fmt)()
                 elif special_formats.has_key(fmt):
                     val = special_formats[fmt](val, name, md)
                 elif fmt=='': val=''