Merge branch 'main' into avm99963-monorail

Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266

GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/tracker/componentcreate.py b/tracker/componentcreate.py
index 9974879..afdddbf 100644
--- a/tracker/componentcreate.py
+++ b/tracker/componentcreate.py
@@ -1,20 +1,16 @@
-# 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.
 
 """A servlet for project owners to create a new component def."""
 from __future__ import print_function
 from __future__ import division
 from __future__ import absolute_import
 
-import logging
 import time
 
-from framework import flaskservlet
 from framework import framework_helpers
 from framework import framework_views
-from framework import jsonfeed
 from framework import permissions
 from framework import servlet
 from framework import urls
@@ -29,7 +25,7 @@
 class ComponentCreate(servlet.Servlet):
   """Servlet allowing project owners to create a component."""
 
-  _MAIN_TAB_MODE = flaskservlet.FlaskServlet.MAIN_TAB_PROCESS
+  _MAIN_TAB_MODE = servlet.Servlet.MAIN_TAB_PROCESS
   _PAGE_TEMPLATE = 'tracker/component-create-page.ezt'
 
   def AssertBasePermission(self, mr):
@@ -39,7 +35,7 @@
       mr: commonly used info parsed from the request.
     """
     super(ComponentCreate, self).AssertBasePermission(mr)
-    if not self.CheckPerm(mr, permissions.EDIT_PROJECT):
+    if not permissions.CanEditProjectConfig(mr, self.services):
       raise permissions.PermissionException(
           'User is not allowed to administer this project')
 
@@ -77,7 +73,7 @@
         'initial_admins': [],
         'initial_cc': [],
         'initial_labels': [],
-        }
+    }
 
   def ProcessFormData(self, mr, post_data):
     """Validate and store the contents of the issues tracker admin page.
@@ -99,7 +95,7 @@
       if not parent_def:
         self.abort(500, 'parent component not found')
       allow_parent_edit = permissions.CanEditComponentDef(
-          mr.auth.effective_ids, mr.perms, mr.project, parent_def, config)
+          mr, self.services, parent_def, config)
       if not allow_parent_edit:
         raise permissions.PermissionException(
             'User is not allowed to add a subcomponent here')
@@ -137,11 +133,11 @@
     return framework_helpers.FormatAbsoluteURL(
         mr, urls.ADMIN_COMPONENTS, saved=1, ts=int(time.time()))
 
-  # def GetComponentCreatePage(self, **kwargs):
-  #   return self.handler(**kwargs)
+  def GetComponentCreatePage(self, **kwargs):
+    return self.handler(**kwargs)
 
-  # def PostComponentCreatePage(self, **kwargs):
-  #   return self.handler(**kwargs)
+  def PostComponentCreatePage(self, **kwargs):
+    return self.handler(**kwargs)
 
 
 def LeafNameErrorMessage(parent_path, leaf_name, config):