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

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


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

Modified Files:
	ustr.py 
Log Message:
Fixed rendering of exceptions that have no args attribute

=== Zope/lib/python/DocumentTemplate/ustr.py 1.3 => 1.4 ===
--- 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:19:07 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)
+