OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Bug module that is necessary for the layout analyzer.""" | 5 """Bug module that is necessary for the layout analyzer.""" |
6 | 6 |
7 import re | 7 import re |
8 | 8 |
9 | 9 |
10 class Bug(object): | 10 class Bug(object): |
11 """A class representing a bug. | 11 """A class representing a bug. |
(...skipping 12 matching lines...) Expand all Loading... |
24 """Initialize the object using raw bug text (such as BUGWK2322). | 24 """Initialize the object using raw bug text (such as BUGWK2322). |
25 | 25 |
26 The bug modifier used in the test expectation file. | 26 The bug modifier used in the test expectation file. |
27 | 27 |
28 Args: | 28 Args: |
29 bug_modifier: a string representing a bug modifier. According to | 29 bug_modifier: a string representing a bug modifier. According to |
30 http://trac.webkit.org/wiki/TestExpectations#Modifiers, | 30 http://trac.webkit.org/wiki/TestExpectations#Modifiers, |
31 currently, BUGWK12345, BUGCR12345, BUGV8_12345, BUGDPRANKE are | 31 currently, BUGWK12345, BUGCR12345, BUGV8_12345, BUGDPRANKE are |
32 possible. | 32 possible. |
33 """ | 33 """ |
34 self.bug_txt = bug_modifier | 34 pattern_for_webkit_bug = r'(BUGWK(\d+))' |
35 pattern_for_webkit_bug = r'BUGWK(\d+)' | |
36 match = re.search(pattern_for_webkit_bug, bug_modifier) | 35 match = re.search(pattern_for_webkit_bug, bug_modifier) |
37 if match: | 36 if match: |
38 self.type = self.WEBKIT | 37 self.type = self.WEBKIT |
39 self.url = self.WEBKIT_BUG_URL + match.group(1) | 38 self.url = self.WEBKIT_BUG_URL + match.group(2) |
| 39 self.bug_txt = match.group(1) |
40 return | 40 return |
41 pattern_for_chrome_bug = r'BUGCR(\d+)' | 41 pattern_for_chrome_bug = r'(BUGCR(\d+))' |
42 match = re.search(pattern_for_chrome_bug, bug_modifier) | 42 match = re.search(pattern_for_chrome_bug, bug_modifier) |
43 if match: | 43 if match: |
44 self.type = self.CHROMIUM | 44 self.type = self.CHROMIUM |
45 self.url = self.CHROME_BUG_URL + match.group(1) | 45 self.url = self.CHROME_BUG_URL + match.group(2) |
| 46 self.bug_txt = match.group(1) |
46 return | 47 return |
47 pattern_for_other_bug = r'BUG(\S+)' | 48 pattern_for_other_bug = r'(BUG(\S+))' |
48 match = re.search(pattern_for_other_bug, bug_modifier) | 49 match = re.search(pattern_for_other_bug, bug_modifier) |
49 if match: | 50 if match: |
50 self.type = self.OTHERS | 51 self.type = self.OTHERS |
51 self.url = 'mailto:%s@chromium.org' % match.group(1).lower() | 52 self.url = 'mailto:%s@chromium.org' % match.group(2).lower() |
| 53 self.bug_txt = match.group(1) |
52 return | 54 return |
53 self.url = '' | 55 self.url = '' |
| 56 self.bug_txt = '' |
54 | 57 |
55 def __str__(self): | 58 def __str__(self): |
56 """Get a string representation of a bug object. | 59 """Get a string representation of a bug object. |
57 | 60 |
58 Returns: | 61 Returns: |
59 a string for HTML link representation of a bug. | 62 a string for HTML link representation of a bug. |
60 """ | 63 """ |
61 return '<a href="%s">%s</a>' % (self.url, self.bug_txt) | 64 return '<a href="%s">%s</a>' % (self.url, self.bug_txt) |
OLD | NEW |