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

Side by Side Diff: utils.py

Issue 19878007: Add build mailer capability to support gatekeeper_ng. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/chromium-build@master
Patch Set: Rebase to latest master Created 7 years, 3 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
« no previous file with comments | « tests/test_mailer/input.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Utils.""" 6 """Utils."""
7 7
8 import re 8 import re
9 import time 9 import time
10 import random 10 import random
11 import logging 11 import logging
12 import sys 12 import sys
13 import string 13 import string
14 import json 14 import json
15 import urllib
15 16
16 from google.appengine.api import users 17 from google.appengine.api import users
17 18
18 19
19 def admin_only(func): 20 def admin_only(func):
20 """Valid for BasePage objects only.""" 21 """Valid for BasePage objects only."""
21 def decorated(self, *args, **kwargs): 22 def decorated(self, *args, **kwargs):
22 if self.is_admin: 23 if self.is_admin:
23 return func(self, *args, **kwargs) 24 return func(self, *args, **kwargs)
24 else: 25 else:
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 def cl_comment(value): 264 def cl_comment(value):
264 """Add links to https:// addresses, BUG=####, and trim excessive newlines.""" 265 """Add links to https:// addresses, BUG=####, and trim excessive newlines."""
265 value = re.sub(r'(https?://.*)', r'<a href="\1">\1</a>', value) 266 value = re.sub(r'(https?://.*)', r'<a href="\1">\1</a>', value)
266 value = re.sub(r'BUG=([\d,]+)', _resolve_crbug, value) 267 value = re.sub(r'BUG=([\d,]+)', _resolve_crbug, value)
267 # Add blockquotes. 268 # Add blockquotes.
268 value = _blockquote(value) 269 value = _blockquote(value)
269 value = re.sub(r'\n', r'<br>', value) 270 value = re.sub(r'\n', r'<br>', value)
270 # Obfuscure email addresses with rot13 encoding. 271 # Obfuscure email addresses with rot13 encoding.
271 value = re.sub(r'(\w+@[\w.]+)', lambda m: rot13_email(m.group(1)), value) 272 value = re.sub(r'(\w+@[\w.]+)', lambda m: rot13_email(m.group(1)), value)
272 return value 273 return value
274
275 def urlquote(value, safe=''):
276 return urllib.quote(value, safe=safe)
OLDNEW
« no previous file with comments | « tests/test_mailer/input.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698