[Zope-Checkins] CVS: Zope/lib/python/Products/PageTemplates -
TALES.py:1.39
Shane Hathaway
shane at zope.com
Tue Feb 3 18:04:42 EST 2004
Update of /cvs-repository/Zope/lib/python/Products/PageTemplates
In directory cvs.zope.org:/tmp/cvs-serv2774
Modified Files:
TALES.py
Log Message:
Catch unauthorized binding errors when formatting an exception
=== Zope/lib/python/Products/PageTemplates/TALES.py 1.38 => 1.39 ===
--- Zope/lib/python/Products/PageTemplates/TALES.py:1.38 Wed May 14 17:55:14 2003
+++ Zope/lib/python/Products/PageTemplates/TALES.py Tue Feb 3 18:04:41 2004
@@ -22,6 +22,7 @@
from MultiMapping import MultiMapping
from DocumentTemplate.DT_Util import ustr
from GlobalTranslationService import getGlobalTranslationService
+from zExceptions import Unauthorized
StringType = type('')
@@ -270,12 +271,18 @@
def getInfo(self, as_html=0):
import pprint
+ from cgi import escape
data = self.context.contexts.copy()
- s = pprint.pformat(data)
+ try:
+ s = pprint.pformat(data)
+ except Unauthorized, e:
+ s = ' - %s: %s' % (getattr(e, '__class__', type(e)), e)
+ if as_html:
+ s = escape(s)
+ return s
if not as_html:
return ' - Names:\n %s' % s.replace('\n', '\n ')
else:
- from cgi import escape
return '<b>Names:</b><pre>%s</pre>' % (escape(s))
More information about the Zope-Checkins
mailing list