Merge branch 'main' into avm99963-monorail

Merged commit cd4b3b336f1f14afa02990fdc2eec5d9467a827e

GitOrigin-RevId: e67bbf185d5538e1472bb42e0abb2a141f88bac1
diff --git a/features/inboundemail.py b/features/inboundemail.py
index 6326dde..d9c36d3 100644
--- a/features/inboundemail.py
+++ b/features/inboundemail.py
@@ -13,17 +13,15 @@
 import os
 import re
 import time
-import urllib
+from six.moves import urllib
 
 import ezt
 
-from google.appengine.api import mail
 from google.appengine.ext.webapp.mail_handlers import BounceNotificationHandler
 
 import webapp2
 
 import settings
-from businesslogic import work_env
 from features import alert2issue
 from features import commitlogcommands
 from features import notify_helpers
@@ -36,7 +34,6 @@
 from framework import sql
 from framework import template_helpers
 from proto import project_pb2
-from tracker import tracker_helpers
 
 
 TEMPLATE_PATH_BASE = framework_constants.TEMPLATE_PATH
@@ -65,17 +62,25 @@
           TEMPLATE_PATH_BASE + template_path,
           compress_whitespace=False, base_format=ezt.FORMAT_RAW)
 
+  # def HandleInboundEmail(self, project_addr=None):
+  #   if self.request.method == 'POST':
+  #     self.post(project_addr)
+  #   elif self.request.method == 'GET':
+  #     self.get(project_addr)
+
   def get(self, project_addr=None):
     logging.info('\n\n\nGET for InboundEmail and project_addr is %r',
                  project_addr)
-    self.Handler(mail.InboundEmailMessage(self.request.body),
-                 urllib.unquote(project_addr))
+    self.Handler(
+        mail.InboundEmailMessage(self.request.body),
+        urllib.parse.unquote(project_addr))
 
   def post(self, project_addr=None):
     logging.info('\n\n\nPOST for InboundEmail and project_addr is %r',
                  project_addr)
-    self.Handler(mail.InboundEmailMessage(self.request.body),
-                 urllib.unquote(project_addr))
+    self.Handler(
+        mail.InboundEmailMessage(self.request.body),
+        urllib.parse.unquote(project_addr))
 
   def Handler(self, inbound_email_message, project_addr):
     """Process an inbound email message."""
@@ -287,6 +292,7 @@
 BAD_WRAP_RE = re.compile('=\r\n')
 BAD_EQ_RE = re.compile('=3D')
 
+
 class BouncedEmail(BounceNotificationHandler):
   """Handler to notice when email to given user is bouncing."""