Merge branch 'main' into avm99963-monorail
Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266
GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/tracker/templatedetail.py b/tracker/templatedetail.py
index a3386b4..4bda006 100644
--- a/tracker/templatedetail.py
+++ b/tracker/templatedetail.py
@@ -1,42 +1,34 @@
-# Copyright 2018 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 2018 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 edit/delete a template"""
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
-import collections
-import logging
import time
import ezt
-from framework import authdata
-from framework import flaskservlet
-from framework import framework_bizobj
from framework import framework_helpers
from framework import framework_views
+from framework import permissions
from framework import servlet
from framework import urls
-from framework import permissions
from tracker import field_helpers
from tracker import template_helpers
from tracker import tracker_bizobj
-from tracker import tracker_helpers
from tracker import tracker_views
-from proto import tracker_pb2
-from services import user_svc
+from mrproto import tracker_pb2
class TemplateDetail(servlet.Servlet):
"""Servlet allowing project owners to edit/delete an issue template"""
- _MAIN_TAB_MODE = flaskservlet.FlaskServlet.MAIN_TAB_PROCESS
+ _MAIN_TAB_MODE = servlet.Servlet.MAIN_TAB_PROCESS
_PAGE_TEMPLATE = 'tracker/template-detail-page.ezt'
- _PROCESS_SUBTAB = flaskservlet.FlaskServlet.PROCESS_TAB_TEMPLATES
+ _PROCESS_SUBTAB = servlet.Servlet.PROCESS_TAB_TEMPLATES
def AssertBasePermission(self, mr):
"""Check whether the user has any permission to visit this page.
@@ -79,7 +71,7 @@
framework_views.RevealAllEmailsToMembers(
mr.cnxn, self.services, mr.auth, users_by_id, mr.project)
field_name_set = {fd.field_name.lower() for fd in config.field_defs
- if fd.field_type is tracker_pb2.FieldTypes.ENUM_TYPE and
+ if fd.field_type == tracker_pb2.FieldTypes.ENUM_TYPE and
not fd.is_deleted}
non_masked_labels = tracker_bizobj.NonMaskedLabels(
template.labels, field_name_set)
@@ -135,7 +127,7 @@
'fields':
[
view for view in field_views
- if view.field_def.type_name is not 'APPROVAL_TYPE'
+ if view.field_def.type_name != 'APPROVAL_TYPE'
],
'initial_add_approvals':
ezt.boolean(prechecked_approvals),
@@ -144,7 +136,7 @@
'approvals':
[
view for view in field_views
- if view.field_def.type_name is 'APPROVAL_TYPE'
+ if view.field_def.type_name == 'APPROVAL_TYPE'
],
'prechecked_approvals':
prechecked_approvals,
@@ -220,12 +212,12 @@
initial_admins=parsed.admin_str,
labels=parsed.labels,
fields=[view for view in field_views
- if view.field_def.type_name is not 'APPROVAL_TYPE'],
+ if view.field_def.type_name != 'APPROVAL_TYPE'],
initial_add_approvals=ezt.boolean(parsed.add_approvals),
initial_phases=[tracker_pb2.Phase(name=name) for name in
parsed.phase_names],
approvals=[view for view in field_views
- if view.field_def.type_name is 'APPROVAL_TYPE'],
+ if view.field_def.type_name == 'APPROVAL_TYPE'],
prechecked_approvals=prechecked_approvals,
required_approval_ids=parsed.required_approval_ids
)
@@ -245,8 +237,8 @@
mr, urls.TEMPLATE_DETAIL, template=template.name,
saved=1, ts=int(time.time()))
- # def GetTemplateDetail(self, **kwargs):
- # return self.handler(**kwargs)
+ def GetTemplateDetail(self, **kwargs):
+ return self.handler(**kwargs)
- # def PostTemplateDetail(self, **kwargs):
- # return self.handler(**kwargs)
+ def PostTemplateDetail(self, **kwargs):
+ return self.handler(**kwargs)