[Zope3-checkins] SVN: Zope3/trunk/src/zope/ There are places in the code where __traceback_info__ is assigned a tuple.

Marius Gedminas marius at pov.lt
Fri Jul 16 11:44:37 EDT 2004


Log message for revision 26581:
  There are places in the code where __traceback_info__ is assigned a tuple.
  Made ExceptionFormatter cope with that.
  
  


Changed:
  U   Zope3/trunk/src/zope/app/fssync/fspickle.py
  U   Zope3/trunk/src/zope/exceptions/exceptionformatter.py
  U   Zope3/trunk/src/zope/exceptions/tests/test_exceptionformatter.py


-=-
Modified: Zope3/trunk/src/zope/app/fssync/fspickle.py
===================================================================
--- Zope3/trunk/src/zope/app/fssync/fspickle.py	2004-07-16 15:38:26 UTC (rev 26580)
+++ Zope3/trunk/src/zope/app/fssync/fspickle.py	2004-07-16 15:44:37 UTC (rev 26581)
@@ -159,7 +159,7 @@
 
     def __init__(self, context):
         locatable = LocationPhysicallyLocatable(context)
-        __traceback_info__ = (context, locatable),
+        __traceback_info__ = (context, locatable)
         self.root = locatable.getRoot()
         self.traverse = ITraverser(self.root).traverse
 

Modified: Zope3/trunk/src/zope/exceptions/exceptionformatter.py
===================================================================
--- Zope3/trunk/src/zope/exceptions/exceptionformatter.py	2004-07-16 15:38:26 UTC (rev 26580)
+++ Zope3/trunk/src/zope/exceptions/exceptionformatter.py	2004-07-16 15:44:37 UTC (rev 26581)
@@ -112,7 +112,7 @@
         return result
 
     def formatTracebackInfo(self, tbi):
-        return self.formatSupplementLine('__traceback_info__: %s' % tbi)
+        return self.formatSupplementLine('__traceback_info__: %s' % (tbi, ))
 
     def formatLine(self, tb):
         f = tb.tb_frame
@@ -218,7 +218,7 @@
     def formatTracebackInfo(self, tbi):
         s = self.escape(str(tbi))
         s = s.replace('\n', self.line_sep)
-        return '__traceback_info__: %s' % s
+        return '__traceback_info__: %s' % (s, )
 
     def formatLine(self, tb):
         line = TextExceptionFormatter.formatLine(self, tb)

Modified: Zope3/trunk/src/zope/exceptions/tests/test_exceptionformatter.py
===================================================================
--- Zope3/trunk/src/zope/exceptions/tests/test_exceptionformatter.py	2004-07-16 15:38:26 UTC (rev 26580)
+++ Zope3/trunk/src/zope/exceptions/tests/test_exceptionformatter.py	2004-07-16 15:44:37 UTC (rev 26581)
@@ -103,6 +103,17 @@
     def testTracebackInfoHTML(self):
         self.testTracebackInfo(1)
 
+    def testTracebackInfoTuple(self):
+        try:
+            __traceback_info__ = ("Adam", "Eve")
+            raise ExceptionForTesting
+        except ExceptionForTesting:
+            s = tb()
+            self.assert_(s.find('Adam') >= 0, s)
+            self.assert_(s.find('Eve') >= 0, s)
+        else:
+            self.fail('no exception occurred')
+
     def testMultipleLevels(self):
         # Makes sure many levels are shown in a traceback.
         def f(n):



More information about the Zope3-Checkins mailing list