← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/kill-plaintext-traceback-rendering into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/kill-plaintext-traceback-rendering into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #181472 in Launchpad itself: "Unused code for rendering tracebacks as plain text"
  https://bugs.launchpad.net/launchpad/+bug/181472

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/kill-plaintext-traceback-rendering/+merge/77647

Remove plaintext traceback rendering.
-- 
https://code.launchpad.net/~stevenk/launchpad/kill-plaintext-traceback-rendering/+merge/77647
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/kill-plaintext-traceback-rendering into lp:launchpad.
=== modified file 'lib/canonical/launchpad/webapp/error.py'
--- lib/canonical/launchpad/webapp/error.py	2011-09-18 18:14:30 +0000
+++ lib/canonical/launchpad/webapp/error.py	2011-09-30 05:57:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -48,7 +48,6 @@
     response_code = httplib.INTERNAL_SERVER_ERROR
 
     show_tracebacks = False
-    pagetesting = False
     debugging = False
     specialuser = False
 
@@ -74,10 +73,6 @@
         self.computeDebugOutput()
         if config.canonical.show_tracebacks:
             self.show_tracebacks = True
-        # if canonical.launchpad.layers.PageTestLayer.providedBy(
-        #     self.request):
-        #     self.pagetesting = True
-        # XXX mpt 20080109 bug=181472: We don't use this any more.
         if canonical.launchpad.layers.DebugLayer.providedBy(self.request):
             self.debugging = True
         self.specialuser = getUtility(ILaunchBag).developer
@@ -97,7 +92,6 @@
         self.error_object
         self.traceback_lines
         self.htmltext
-        self.plaintext
         """
         self.error_type, self.error_object, tb = sys.exc_info()
         try:
@@ -106,10 +100,6 @@
                 format_exception(self.error_type, self.error_object,
                                  tb, as_html=True)
                 )
-            self.plaintext = ''.join(
-                format_exception(self.error_type, self.error_object,
-                                 tb, as_html=False)
-                )
         finally:
             del tb
 
@@ -127,11 +117,7 @@
         # If the config says to show tracebacks, or we're on the debug port,
         # or the logged in user is in the launchpad team, show tracebacks.
         if self.show_tracebacks or self.debugging or self.specialuser:
-            if self.pagetesting:
-                # Show tracebacks in page tests, but formatted as plain text.
-                return self.inside_div('<pre>\n%s</pre>' % self.plaintext)
-            else:
-                return self.inside_div(self.htmltext)
+            return self.inside_div(self.htmltext)
         else:
             return ''
 
@@ -149,18 +135,8 @@
         else:
             return oops_code
 
-    def render_as_text(self):
-        """Render the exception as text.
-
-        This is used to render exceptions in pagetests.
-        """
-        self.request.response.setHeader('Content-Type', 'text/plain')
-        return self.plaintext
-
     def __call__(self):
-        if self.pagetesting:
-            return self.render_as_text()
-        elif (config.launchpad.restrict_to_team and
+        if (config.launchpad.restrict_to_team and
               not self.safe_to_show_in_restricted_mode):
             return self.plain_oops_template()
         else: