Merge branch 'main' into avm99963-monorail

Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266

GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/tracker/issueattachmenttext.py b/tracker/issueattachmenttext.py
index 40db170..c12d135 100644
--- a/tracker/issueattachmenttext.py
+++ b/tracker/issueattachmenttext.py
@@ -1,7 +1,6 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file or at
-# https://developers.google.com/open-source/licenses/bsd
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 
 """Servlet to safely display textual issue attachments.
 
@@ -13,6 +12,7 @@
 from __future__ import absolute_import
 
 import logging
+import six
 
 import ezt
 from google.appengine.api import app_identity
@@ -20,7 +20,6 @@
 
 from features import prettify
 from framework import exceptions
-from framework import flaskservlet
 from framework import filecontent
 from framework import permissions
 from framework import servlet
@@ -34,7 +33,7 @@
   """AttachmentText displays textual attachments much like source browsing."""
 
   _PAGE_TEMPLATE = 'tracker/issue-attachment-text.ezt'
-  _MAIN_TAB_MODE = flaskservlet.FlaskServlet.MAIN_TAB_ISSUES
+  _MAIN_TAB_MODE = servlet.Servlet.MAIN_TAB_ISSUES
 
   def GatherPageData(self, mr):
     """Parse the attachment ID from the request and serve its content.
@@ -80,7 +79,7 @@
       self.abort(400, 'not a text file')
 
     u_text, is_binary, too_large = filecontent.DecodeFileContents(content)
-    lines = prettify.PrepareSourceLinesForHighlighting(u_text.encode('utf8'))
+    lines = prettify.PrepareSourceLinesForHighlighting(six.ensure_str(u_text))
 
     config = self.services.config.GetProjectConfig(mr.cnxn, mr.project_id)
     granted_perms = tracker_bizobj.GetGrantedPerms(
@@ -108,5 +107,5 @@
 
     return page_data
 
-  # def GetAttachmentText(self, **kwargs):
-  #   return self.handler(**kwargs)
+  def GetAttachmentText(self, **kwargs):
+    return self.handler(**kwargs)