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

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


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

Modified Files:
	DT_Var.py 
Log Message:
Merged Hotfix_2001-09-28

=== Zope/lib/python/DocumentTemplate/DT_Var.py 1.43 => 1.44 ===
         # 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=''
@@ -307,7 +311,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=''