Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/python | |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 import re | |
| 7 | |
| 8 | |
| 9 class Bug: | |
| 10 """A class dealing with bug. | |
| 11 | |
| 12 TODO(imasaki): add more functionalities here if bug-tracker API is available. | |
| 13 For example, you can get owner of the bug. | |
| 14 """ | |
| 15 CHROME_BUG_URL = 'http://crbug.com/' | |
| 16 WEBKIT_BUG_URL = 'http://bugs.webkit.org/show_bug.cgi?id=' | |
|
Ami GONE FROM CHROMIUM
2011/08/23 14:49:14
FWIW there's a redirect from http://webkit.org/b/<
imasaki1
2011/08/23 21:18:03
Done.
| |
| 17 # Type enum for the bug | |
| 18 WEBKIT = 0 | |
| 19 CHROMIUM = 1 | |
| 20 OTHERS = 2 | |
| 21 | |
| 22 def __init__(self, bug_txt): | |
| 23 self.bug_txt = bug_txt | |
| 24 pattern_for_webkit_bug = r'BUGWK(\d+)' | |
| 25 match = re.search(pattern_for_webkit_bug, bug_txt) | |
| 26 if match: | |
| 27 self.type = self.WEBKIT | |
| 28 self.url = self.WEBKIT_BUG_URL + match.group(1) | |
| 29 return | |
| 30 pattern_for_chrome_bug = r'BUGCR(\d+)' | |
| 31 match = re.search(pattern_for_chrome_bug, bug_txt) | |
| 32 if match: | |
| 33 self.type = self.CHROMIUM | |
| 34 self.url = self.CHROME_BUG_URL + match.group(1) | |
| 35 return | |
| 36 pattern_for_other_bug = r'BUG(\S+)' | |
| 37 match = re.search(pattern_for_other_bug, bug_txt) | |
| 38 if match: | |
| 39 self.type = self.OTHERS | |
| 40 self.url = 'mailto:%s@chromium.org' % match.group(1).lower() | |
| 41 return | |
| 42 self.url = '' | |
| 43 | |
| 44 def ToString(self): | |
| 45 return '<a href="%s">%s</a>' % (self.url, self.bug_txt) | |
| OLD | NEW |