Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: appengine/monorail/features/filterrules_views.py

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is govered by a BSD-style
3 # license that can be found in the LICENSE file or at
4 # https://developers.google.com/open-source/licenses/bsd
5
6 """Classes to display filter rules in templates."""
7
8 import logging
9
10 from framework import template_helpers
11
12
13 class RuleView(template_helpers.PBProxy):
14 """Wrapper class that makes it easier to display a Rule via EZT."""
15
16 def __init__(self, rule_pb, users_by_id):
17 super(RuleView, self).__init__(rule_pb)
18
19 self.action_type = ''
20 self.action_value = ''
21
22 if rule_pb is None:
23 return # Just leave everything as ''
24
25 # self.predicate is automatically available.
26
27 # For the current UI, we assume that each rule has exactly
28 # one action, so we can determine the text value for it here.
29 if rule_pb.default_status:
30 self.action_type = 'default_status'
31 self.action_value = rule_pb.default_status
32 elif rule_pb.default_owner_id:
33 self.action_type = 'default_owner'
34 self.action_value = users_by_id[rule_pb.default_owner_id].email
35 elif rule_pb.add_cc_ids:
36 self.action_type = 'add_ccs'
37 usernames = [users_by_id[cc_id].email for cc_id in rule_pb.add_cc_ids]
38 self.action_value = ', '.join(usernames)
39 elif rule_pb.add_labels:
40 self.action_type = 'add_labels'
41 self.action_value = ', '.join(rule_pb.add_labels)
42 elif rule_pb.add_notify_addrs:
43 self.action_type = 'also_notify'
44 self.action_value = ', '.join(rule_pb.add_notify_addrs)
OLDNEW
« no previous file with comments | « appengine/monorail/features/filterrules_helpers.py ('k') | appengine/monorail/features/inboundemail.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698