Merge branch 'main' into avm99963-monorail

Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266

GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/tracker/issueentry.py b/tracker/issueentry.py
index 2ae59d8..287c638 100644
--- a/tracker/issueentry.py
+++ b/tracker/issueentry.py
@@ -1,14 +1,12 @@
-# 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 that implements the entry of new issues."""
 from __future__ import print_function
 from __future__ import division
 from __future__ import absolute_import
 
-import collections
 import difflib
 import logging
 import string
@@ -16,9 +14,7 @@
 
 from businesslogic import work_env
 from features import hotlist_helpers
-from features import send_notifications
 from framework import exceptions
-from framework import flaskservlet
 from framework import framework_bizobj
 from framework import framework_constants
 from framework import framework_helpers
@@ -34,7 +30,7 @@
 from tracker import tracker_constants
 from tracker import tracker_helpers
 from tracker import tracker_views
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 
 PLACEHOLDER_SUMMARY = 'Enter one-line summary'
 PHASES_WITH_MILESTONES = ['Beta', 'Stable', 'Stable-Exp', 'Stable-Full']
@@ -46,7 +42,7 @@
   """IssueEntry shows a page with a simple form to enter a new issue."""
 
   _PAGE_TEMPLATE = 'tracker/issue-entry-page.ezt'
-  _MAIN_TAB_MODE = flaskservlet.FlaskServlet.MAIN_TAB_ISSUES
+  _MAIN_TAB_MODE = servlet.Servlet.MAIN_TAB_ISSUES
 
   # The issue filing wizard is a separate app that posted back to Monorail's
   # issue entry page. To make this possible for the wizard, we need to allow
@@ -392,6 +388,12 @@
         mr, config, field_values, labels, template.field_values,
         template.labels)
 
+    # This ValidateLabels call is redundant with work already done
+    # in CreateIssue. However, this instance passes in an ezt_errors object
+    # to allow showing related errors next to the fields they happen on.
+    field_helpers.ValidateLabels(
+        mr.cnxn, self.services, mr.project_id, labels, ezt_errors=mr.errors)
+
     # This ValidateCustomFields call is redundant with work already done
     # in CreateIssue. However, this instance passes in an ezt_errors object
     # to allow showing related errors next to the fields they happen on.
@@ -466,7 +468,7 @@
         except exceptions.OverAttachmentQuota:
           mr.errors.attachments = 'Project attachment quota exceeded.'
         except exceptions.InputException as e:
-          if 'Undefined or deprecated component with id' in e.message:
+          if 'Undefined or deprecated component with id' in str(e):
             mr.errors.components = 'Undefined or deprecated component'
 
     mr.template_name = parsed.template_name
@@ -512,11 +514,11 @@
 
     return template
 
-  # def GetIssueEntry(self, **kwargs):
-  #   return self.handler(**kwargs)
+  def GetIssueEntry(self, **kwargs):
+    return self.handler(**kwargs)
 
-  # def PostIssueEntry(self, **kwargs):
-  #   return self.handler(**kwargs)
+  def PostIssueEntry(self, **kwargs):
+    return self.handler(**kwargs)
 
 
 def _AttachDefaultApprovers(config, approval_values):