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

Unified Diff: handlers/policy_checklist/handler.py

Issue 23576004: Don't send mail for policy_checklist comments. (Closed) Base URL: https://git.chromium.org/git/chromium/tools/reviewbot.git@master
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | rietveld.py » ('j') | rietveld.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: handlers/policy_checklist/handler.py
diff --git a/handlers/policy_checklist/handler.py b/handlers/policy_checklist/handler.py
index ec26e37749cf3f5abf4070fbd979c720e320f989..3144cdf4492052b6ac1991e7a6fc9c35539073c9 100644
--- a/handlers/policy_checklist/handler.py
+++ b/handlers/policy_checklist/handler.py
@@ -31,6 +31,17 @@ JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))
+def prepare_address_list(addr, email_list):
+ """Prepares |email_list| for use as rietveld query parameter.
+
+ Canonicalizes the entries in |email_list|, removes any occurrences of |addr|,
+ joins the entries with commas and returns the result.
+ """
+ return ','.join([item for canonicalized in map(util.get_emails, email_list)
+ for item in canonicalized
agable 2013/08/27 14:49:19 Double-nested fors in list comprehensions are ugly
Mattias Nissler (ping if slow) 2013/08/27 15:08:41 Note that the nesting also flattens the list of li
agable 2013/08/27 15:56:26 Ah, I'd missed the nesting from get_emails. Seems
Mattias Nissler (ping if slow) 2013/08/27 16:07:23 Done.
+ if item != addr])
+
+
def process(addr, message, review, rietveld):
"""Handles reviews for chrome/app/policy/policy_templates.json.
@@ -78,4 +89,8 @@ def process(addr, message, review, rietveld):
# Finally, post all inline comments.
if len(chunks) > 0:
template = JINJA_ENVIRONMENT.get_template(REVIEW_MESSAGE_TEMPLATE)
- rietveld.post_comment(review.issue_id, template.render(review=review), True)
+ rietveld.publish_inline_comments(
+ review.issue_id, template.render(review=review),
+ prepare_address_list(addr, review.issue_data.reviewers),
+ prepare_address_list(addr, review.issue_data.cc),
+ send_mail=False)
agable 2013/08/27 14:49:19 send_mail defaults to False.
Mattias Nissler (ping if slow) 2013/08/27 15:08:41 Done.
« no previous file with comments | « no previous file | rietveld.py » ('j') | rietveld.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698