[Zope-Checkins] CVS: Zope/lib/python/DocumentTemplate - ustr.py:1.3.22.1

Shane Hathaway shane@zope.com
Mon, 16 Dec 2002 18:20:20 -0500


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

Modified Files:
      Tag: Zope-2_6-branch
	ustr.py 
Log Message:
Merge from HEAD: Fixed rendering of exceptions that have no args attribute

=== Zope/lib/python/DocumentTemplate/ustr.py 1.3 => 1.3.22.1 ===
--- Zope/lib/python/DocumentTemplate/ustr.py:1.3	Thu Apr 25 08:45:11 2002
+++ Zope/lib/python/DocumentTemplate/ustr.py	Mon Dec 16 18:20:20 2002
@@ -50,10 +50,13 @@
         return str(v)
 
 
-def _exception_str(self):
-    if not self.args:
-        return ''
-    elif len(self.args) == 1:
-        return ustr(self.args[0])
-    else:
-        return str(self.args)
+def _exception_str(exc):
+    if hasattr(exc, 'args'):
+        if not exc.args:
+            return ''
+        elif len(exc.args) == 1:
+            return ustr(exc.args[0])
+        else:
+            return str(exc.args)
+    return str(exc)
+