Merge branch 'main' into avm99963-monorail
Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266
GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/tracker/fieldcreate.py b/tracker/fieldcreate.py
index b1f2316..245b697 100644
--- a/tracker/fieldcreate.py
+++ b/tracker/fieldcreate.py
@@ -1,27 +1,22 @@
-# 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 field def."""
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
-import logging
import re
import time
import ezt
-from framework import exceptions
-from framework import flaskservlet
from framework import framework_helpers
-from framework import jsonfeed
from framework import permissions
from framework import servlet
from framework import urls
-from proto import tracker_pb2
+from mrproto import tracker_pb2
from tracker import field_helpers
from tracker import tracker_bizobj
from tracker import tracker_constants
@@ -31,7 +26,7 @@
class FieldCreate(servlet.Servlet):
"""Servlet allowing project owners to create a custom field."""
- _MAIN_TAB_MODE = flaskservlet.FlaskServlet.MAIN_TAB_PROCESS
+ _MAIN_TAB_MODE = servlet.Servlet.MAIN_TAB_PROCESS
_PAGE_TEMPLATE = 'tracker/field-create-page.ezt'
def AssertBasePermission(self, mr):
@@ -41,7 +36,7 @@
mr: commonly used info parsed from the request.
"""
super(FieldCreate, self).AssertBasePermission(mr)
- if not self.CheckPerm(mr, permissions.EDIT_PROJECT):
+ if not permissions.CanEditProjectConfig(mr, self.services):
raise permissions.PermissionException(
'You are not allowed to administer this project')
@@ -125,7 +120,8 @@
parsed.is_restricted_field), 'Approval fields cannot be restricted.'
if parsed.approvers_str:
approver_ids_dict = self.services.user.LookupUserIDs(
- mr.cnxn, re.split('[,;\s]+', parsed.approvers_str),
+ mr.cnxn,
+ re.split(r'[,;\s]+', parsed.approvers_str),
autocreate=True)
approver_ids = list(set(approver_ids_dict.values()))
else:
@@ -199,11 +195,11 @@
return framework_helpers.FormatAbsoluteURL(
mr, urls.ADMIN_LABELS, saved=1, ts=int(time.time()))
- # def GetFieldCreate(self, **kwargs):
- # return self.handler(**kwargs)
+ def GetFieldCreate(self, **kwargs):
+ return self.handler(**kwargs)
- # def PostFieldCreate(self, **kwargs):
- # return self.handler(**kwargs)
+ def PostFieldCreate(self, **kwargs):
+ return self.handler(**kwargs)
def FieldNameErrorMessage(field_name, config):