Merge lp:~jtv/launchpad/bug-228940 into lp:launchpad
- bug-228940
- Merge into devel
Proposed by
Jeroen T. Vermeulen
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Graham Binns | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 12240 | ||||
Proposed branch: | lp:~jtv/launchpad/bug-228940 | ||||
Merge into: | lp:launchpad | ||||
Prerequisite: | lp:~jtv/launchpad/bug-34102 | ||||
Diff against target: |
737 lines (+96/-97) 16 files modified
lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt (+5/-4) lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt (+3/-3) lib/lp/bugs/doc/externalbugtracker-bugzilla.txt (+3/-3) lib/lp/bugs/doc/externalbugtracker-sourceforge.txt (+3/-2) lib/lp/bugs/doc/externalbugtracker-trac.txt (+10/-8) lib/lp/bugs/doc/externalbugtracker.txt (+4/-4) lib/lp/bugs/externalbugtracker/__init__.py (+4/-4) lib/lp/bugs/externalbugtracker/base.py (+6/-6) lib/lp/bugs/externalbugtracker/bugzilla.py (+16/-15) lib/lp/bugs/externalbugtracker/mantis.py (+16/-23) lib/lp/bugs/externalbugtracker/roundup.py (+3/-3) lib/lp/bugs/externalbugtracker/sourceforge.py (+4/-5) lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py (+3/-3) lib/lp/bugs/externalbugtracker/trac.py (+9/-7) lib/lp/bugs/scripts/checkwatches/utilities.py (+6/-6) lib/lp/code/errors.py (+1/-1) |
||||
To merge this branch: | bzr merge lp:~jtv/launchpad/bug-228940 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Graham Binns (community) | code | Approve | |
Review via email: mp+46725@code.launchpad.net |
Commit message
[r=gmb][ui=none][bug=228940] s/Unparseable/
Description of the change
= Bug 228940 =
As per Graham's emphatic request, this corrects the spelling of "unparseable" throughout lib/lp and lib/canonical. I also fixed most of the lint I found, though there are still disappointing amounts left.
Jeroen
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt' | |||
2 | --- lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt 2010-10-18 22:24:59 +0000 | |||
3 | +++ lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt 2011-01-19 04:53:42 +0000 | |||
4 | @@ -280,14 +280,14 @@ | |||
5 | 280 | BugNotFound: no-such-bug | 280 | BugNotFound: no-such-bug |
6 | 281 | 281 | ||
7 | 282 | If the data we've imported from Bugzilla is incomplete and doesn't | 282 | If the data we've imported from Bugzilla is incomplete and doesn't |
9 | 283 | contain either the bug's status or its resolution an UnparseableBugData | 283 | contain either the bug's status or its resolution an UnparsableBugData |
10 | 284 | error will be raised. We can add a sample bug to demonstrate this. | 284 | error will be raised. We can add a sample bug to demonstrate this. |
11 | 285 | 285 | ||
12 | 286 | >>> bugzilla._bugs[999] = {} | 286 | >>> bugzilla._bugs[999] = {} |
13 | 287 | >>> bugzilla.getRemoteStatus(999) | 287 | >>> bugzilla.getRemoteStatus(999) |
14 | 288 | Traceback (most recent call last): | 288 | Traceback (most recent call last): |
15 | 289 | ... | 289 | ... |
17 | 290 | UnparseableBugData: No status or resolution defined for bug 999 | 290 | UnparsableBugData: No status or resolution defined for bug 999 |
18 | 291 | 291 | ||
19 | 292 | >>> del bugzilla._bugs[999] | 292 | >>> del bugzilla._bugs[999] |
20 | 293 | 293 | ||
21 | @@ -338,7 +338,7 @@ | |||
22 | 338 | ... print " %s: %s" % (key, bugzilla._bugs[bug][key]) | 338 | ... print " %s: %s" % (key, bugzilla._bugs[bug][key]) |
23 | 339 | ... print "\n" | 339 | ... print "\n" |
24 | 340 | Bug 1: | 340 | Bug 1: |
26 | 341 | alias: | 341 | alias: |
27 | 342 | assigned_to: test@canonical.com... | 342 | assigned_to: test@canonical.com... |
28 | 343 | Bug 2: | 343 | Bug 2: |
29 | 344 | alias: bug-two | 344 | alias: bug-two |
30 | @@ -387,7 +387,8 @@ | |||
31 | 387 | instance. | 387 | instance. |
32 | 388 | 388 | ||
33 | 389 | >>> from canonical.launchpad.webapp.testing import verifyObject | 389 | >>> from canonical.launchpad.webapp.testing import verifyObject |
35 | 390 | >>> from lp.bugs.interfaces.externalbugtracker import ISupportsCommentImport | 390 | >>> from lp.bugs.interfaces.externalbugtracker import ( |
36 | 391 | ... ISupportsCommentImport) | ||
37 | 391 | >>> verifyObject(ISupportsCommentImport, bugzilla) | 392 | >>> verifyObject(ISupportsCommentImport, bugzilla) |
38 | 392 | True | 393 | True |
39 | 393 | 394 | ||
40 | 394 | 395 | ||
41 | === modified file 'lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt' | |||
42 | --- lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt 2010-10-18 22:24:59 +0000 | |||
43 | +++ lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt 2011-01-19 04:53:42 +0000 | |||
44 | @@ -25,8 +25,8 @@ | |||
45 | 25 | >>> for bug_watch in mozilla_bugzilla.watches: | 25 | >>> for bug_watch in mozilla_bugzilla.watches: |
46 | 26 | ... print "%s: %s %s" % (bug_watch.remotebug, | 26 | ... print "%s: %s %s" % (bug_watch.remotebug, |
47 | 27 | ... bug_watch.remotestatus, bug_watch.remote_importance) | 27 | ... bug_watch.remotestatus, bug_watch.remote_importance) |
50 | 28 | 2000: | 28 | 2000: |
51 | 29 | 123543: | 29 | 123543: |
52 | 30 | 42: FUBAR BAZBAZ | 30 | 42: FUBAR BAZBAZ |
53 | 31 | 42: FUBAR BAZBAZ | 31 | 42: FUBAR BAZBAZ |
54 | 32 | >>> transaction.commit() | 32 | >>> transaction.commit() |
55 | @@ -136,5 +136,5 @@ | |||
56 | 136 | >>> broken_bugzilla.initializeRemoteBugDB(remote_bugs) | 136 | >>> broken_bugzilla.initializeRemoteBugDB(remote_bugs) |
57 | 137 | Traceback (most recent call last): | 137 | Traceback (most recent call last): |
58 | 138 | ... | 138 | ... |
60 | 139 | UnparseableBugData: Failed to parse XML description... | 139 | UnparsableBugData: Failed to parse XML description... |
61 | 140 | 140 | ||
62 | 141 | 141 | ||
63 | === modified file 'lib/lp/bugs/doc/externalbugtracker-bugzilla.txt' | |||
64 | --- lib/lp/bugs/doc/externalbugtracker-bugzilla.txt 2011-01-18 18:36:49 +0000 | |||
65 | +++ lib/lp/bugs/doc/externalbugtracker-bugzilla.txt 2011-01-19 04:53:42 +0000 | |||
66 | @@ -22,14 +22,14 @@ | |||
67 | 22 | 22 | ||
68 | 23 | The Bugzilla ExternalBugTracker works differently depending on which | 23 | The Bugzilla ExternalBugTracker works differently depending on which |
69 | 24 | version of Bugzilla it is talking to. If it's a version we can't parse, | 24 | version of Bugzilla it is talking to. If it's a version we can't parse, |
71 | 25 | UnparseableBugTrackerVersion is raised: | 25 | UnparsableBugTrackerVersion is raised: |
72 | 26 | 26 | ||
73 | 27 | >>> from canonical.testing.layers import LaunchpadZopelessLayer | 27 | >>> from canonical.testing.layers import LaunchpadZopelessLayer |
74 | 28 | >>> txn = LaunchpadZopelessLayer.txn | 28 | >>> txn = LaunchpadZopelessLayer.txn |
75 | 29 | >>> external_bugzilla = Bugzilla('http://example.com/', version='A.B') | 29 | >>> external_bugzilla = Bugzilla('http://example.com/', version='A.B') |
76 | 30 | Traceback (most recent call last): | 30 | Traceback (most recent call last): |
77 | 31 | ... | 31 | ... |
79 | 32 | UnparseableBugTrackerVersion: | 32 | UnparsableBugTrackerVersion: |
80 | 33 | Failed to parse version 'A.B' for http://... | 33 | Failed to parse version 'A.B' for http://... |
81 | 34 | 34 | ||
82 | 35 | The version parsing is carried out by the Bugzilla._parseVersion() | 35 | The version parsing is carried out by the Bugzilla._parseVersion() |
83 | @@ -669,7 +669,7 @@ | |||
84 | 669 | ... external_bugzilla, [bug_watch1, bug_watch2]) | 669 | ... external_bugzilla, [bug_watch1, bug_watch2]) |
85 | 670 | Traceback (most recent call last): | 670 | Traceback (most recent call last): |
86 | 671 | ... | 671 | ... |
88 | 672 | UnparseableBugData: | 672 | UnparsableBugData: |
89 | 673 | Failed to parse XML description for https://bugzilla.mozilla.org... | 673 | Failed to parse XML description for https://bugzilla.mozilla.org... |
90 | 674 | 674 | ||
91 | 675 | The error is also recorded in each bug watch's last_error_type field so that | 675 | The error is also recorded in each bug watch's last_error_type field so that |
92 | 676 | 676 | ||
93 | === modified file 'lib/lp/bugs/doc/externalbugtracker-sourceforge.txt' | |||
94 | --- lib/lp/bugs/doc/externalbugtracker-sourceforge.txt 2010-10-18 22:24:59 +0000 | |||
95 | +++ lib/lp/bugs/doc/externalbugtracker-sourceforge.txt 2011-01-19 04:53:42 +0000 | |||
96 | @@ -96,7 +96,7 @@ | |||
97 | 96 | >>> sourceforge.initializeRemoteBugDB([0]) | 96 | >>> sourceforge.initializeRemoteBugDB([0]) |
98 | 97 | Traceback (most recent call last): | 97 | Traceback (most recent call last): |
99 | 98 | ... | 98 | ... |
101 | 99 | UnparseableBugData: Remote bug 0 does not define a status. | 99 | UnparsableBugData: Remote bug 0 does not define a status. |
102 | 100 | 100 | ||
103 | 101 | Some SourceForge bugs are marked private. Although we can't import a | 101 | Some SourceForge bugs are marked private. Although we can't import a |
104 | 102 | status from them, we don't raise an error when trying to initialize the | 102 | status from them, we don't raise an error when trying to initialize the |
105 | @@ -141,7 +141,8 @@ | |||
106 | 141 | Launchpad.dev bug #10 is the same bug as reported in example.com bug | 141 | Launchpad.dev bug #10 is the same bug as reported in example.com bug |
107 | 142 | #1722250, so we add a watch against the remote bug. | 142 | #1722250, so we add a watch against the remote bug. |
108 | 143 | 143 | ||
110 | 144 | >>> from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities | 144 | >>> from canonical.launchpad.interfaces.launchpad import ( |
111 | 145 | ... ILaunchpadCelebrities) | ||
112 | 145 | >>> from lp.registry.interfaces.person import IPersonSet | 146 | >>> from lp.registry.interfaces.person import IPersonSet |
113 | 146 | >>> from lp.bugs.tests.externalbugtracker import ( | 147 | >>> from lp.bugs.tests.externalbugtracker import ( |
114 | 147 | ... new_bugtracker) | 148 | ... new_bugtracker) |
115 | 148 | 149 | ||
116 | === modified file 'lib/lp/bugs/doc/externalbugtracker-trac.txt' | |||
117 | --- lib/lp/bugs/doc/externalbugtracker-trac.txt 2010-11-10 09:28:09 +0000 | |||
118 | +++ lib/lp/bugs/doc/externalbugtracker-trac.txt 2011-01-19 04:53:42 +0000 | |||
119 | @@ -157,7 +157,7 @@ | |||
120 | 157 | remote bug IDs will fetch those bug IDs from the server and file them in a | 157 | remote bug IDs will fetch those bug IDs from the server and file them in a |
121 | 158 | local variable for later use. | 158 | local variable for later use. |
122 | 159 | 159 | ||
124 | 160 | We use a test-oriented implementation for the purposes of these tests, which | 160 | We use a test-oriented implementation for the purposes of these tests, which |
125 | 161 | overrides ExternalBugTracker.urlopen() so that we don't have to rely on a | 161 | overrides ExternalBugTracker.urlopen() so that we don't have to rely on a |
126 | 162 | working network connection. | 162 | working network connection. |
127 | 163 | 163 | ||
128 | @@ -208,7 +208,7 @@ | |||
129 | 208 | CALLED urlopen(u'http://test.trac/query?id=6&id=7...&format=csv') | 208 | CALLED urlopen(u'http://test.trac/query?id=6&id=7...&format=csv') |
130 | 209 | 209 | ||
131 | 210 | If, when using the batch export method, the Trac instance comes across | 210 | If, when using the batch export method, the Trac instance comes across |
133 | 211 | invalid data, it will raise an UnparseableBugData exception. We will | 211 | invalid data, it will raise an UnparsableBugData exception. We will |
134 | 212 | force our trac instance to use invalid data for the purposes of this | 212 | force our trac instance to use invalid data for the purposes of this |
135 | 213 | test. | 213 | test. |
136 | 214 | 214 | ||
137 | @@ -216,7 +216,7 @@ | |||
138 | 216 | >>> trac.initializeRemoteBugDB([6, 7, 8, 9, 10]) | 216 | >>> trac.initializeRemoteBugDB([6, 7, 8, 9, 10]) |
139 | 217 | Traceback (most recent call last): | 217 | Traceback (most recent call last): |
140 | 218 | ... | 218 | ... |
142 | 219 | UnparseableBugData: External bugtracker http://test.trac does not | 219 | UnparsableBugData: External bugtracker http://test.trac does not |
143 | 220 | define all the necessary fields for bug status imports (Defined | 220 | define all the necessary fields for bug status imports (Defined |
144 | 221 | field names: ['<html>']). | 221 | field names: ['<html>']). |
145 | 222 | 222 | ||
146 | @@ -226,7 +226,7 @@ | |||
147 | 226 | >>> trac.initializeRemoteBugDB([6]) | 226 | >>> trac.initializeRemoteBugDB([6]) |
148 | 227 | Traceback (most recent call last): | 227 | Traceback (most recent call last): |
149 | 228 | ... | 228 | ... |
151 | 229 | UnparseableBugData: External bugtracker http://test.trac does not | 229 | UnparsableBugData: External bugtracker http://test.trac does not |
152 | 230 | define all the necessary fields for bug status imports (Defined | 230 | define all the necessary fields for bug status imports (Defined |
153 | 231 | field names: ['<html>']). | 231 | field names: ['<html>']). |
154 | 232 | 232 | ||
155 | @@ -261,13 +261,13 @@ | |||
156 | 261 | [1, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153] | 261 | [1, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153] |
157 | 262 | 262 | ||
158 | 263 | If _fetchBugData() receives a response that isn't a valid Trac CSV | 263 | If _fetchBugData() receives a response that isn't a valid Trac CSV |
160 | 264 | export, it will raise an UnparseableBugData error. | 264 | export, it will raise an UnparsableBugData error. |
161 | 265 | 265 | ||
162 | 266 | >>> trac.csv_export_file = 'trac_example_broken_ticket_export.csv' | 266 | >>> trac.csv_export_file = 'trac_example_broken_ticket_export.csv' |
163 | 267 | >>> trac._fetchBugData(query_url) | 267 | >>> trac._fetchBugData(query_url) |
164 | 268 | Traceback (most recent call last): | 268 | Traceback (most recent call last): |
165 | 269 | ... | 269 | ... |
167 | 270 | UnparseableBugData: External bugtracker http://test.trac does not | 270 | UnparsableBugData: External bugtracker http://test.trac does not |
168 | 271 | define all the necessary fields for bug status imports (Defined | 271 | define all the necessary fields for bug status imports (Defined |
169 | 272 | field names: ['<html>']). | 272 | field names: ['<html>']). |
170 | 273 | 273 | ||
171 | @@ -279,11 +279,13 @@ | |||
172 | 279 | >>> from lp.bugs.interfaces.bug import IBugSet | 279 | >>> from lp.bugs.interfaces.bug import IBugSet |
173 | 280 | >>> from lp.registry.interfaces.person import IPersonSet | 280 | >>> from lp.registry.interfaces.person import IPersonSet |
174 | 281 | 281 | ||
176 | 282 | >>> sample_person = getUtility(IPersonSet).getByEmail('test@canonical.com') | 282 | >>> sample_person = getUtility(IPersonSet).getByEmail( |
177 | 283 | ... 'test@canonical.com') | ||
178 | 283 | 284 | ||
179 | 284 | >>> example_bug_tracker = new_bugtracker(BugTrackerType.TRAC) | 285 | >>> example_bug_tracker = new_bugtracker(BugTrackerType.TRAC) |
180 | 285 | 286 | ||
182 | 286 | >>> from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities | 287 | >>> from canonical.launchpad.interfaces.launchpad import ( |
183 | 288 | ... ILaunchpadCelebrities) | ||
184 | 287 | >>> example_bug = getUtility(IBugSet).get(10) | 289 | >>> example_bug = getUtility(IBugSet).get(10) |
185 | 288 | >>> example_bugwatch = example_bug.addWatch( | 290 | >>> example_bugwatch = example_bug.addWatch( |
186 | 289 | ... example_bug_tracker, '1', | 291 | ... example_bug_tracker, '1', |
187 | 290 | 292 | ||
188 | === modified file 'lib/lp/bugs/doc/externalbugtracker.txt' | |||
189 | --- lib/lp/bugs/doc/externalbugtracker.txt 2010-12-20 03:21:03 +0000 | |||
190 | +++ lib/lp/bugs/doc/externalbugtracker.txt 2011-01-19 04:53:42 +0000 | |||
191 | @@ -730,7 +730,7 @@ | |||
192 | 730 | 730 | ||
193 | 731 | >>> from lp.bugs.externalbugtracker import ( | 731 | >>> from lp.bugs.externalbugtracker import ( |
194 | 732 | ... BugNotFound, BugTrackerConnectError, InvalidBugId, | 732 | ... BugNotFound, BugTrackerConnectError, InvalidBugId, |
196 | 733 | ... UnparseableBugData, UnparseableBugTrackerVersion) | 733 | ... UnparsableBugData, UnparsableBugTrackerVersion) |
197 | 734 | 734 | ||
198 | 735 | TestBrokenExternalBugTracker allows us to force errors to occur, so we | 735 | TestBrokenExternalBugTracker allows us to force errors to occur, so we |
199 | 736 | can use it to check that bug watches' last_error_types are being set | 736 | can use it to check that bug watches' last_error_types are being set |
200 | @@ -746,8 +746,8 @@ | |||
201 | 746 | checkwatches ran instead of just once every 24 hours like any other bug | 746 | checkwatches ran instead of just once every 24 hours like any other bug |
202 | 747 | watch. | 747 | watch. |
203 | 748 | 748 | ||
206 | 749 | >>> for error in [BugTrackerConnectError, UnparseableBugData, | 749 | >>> for error in [BugTrackerConnectError, UnparsableBugData, |
207 | 750 | ... UnparseableBugTrackerVersion, Exception]: | 750 | ... UnparsableBugTrackerVersion, Exception]: |
208 | 751 | ... example_bugwatch.lastchecked = None | 751 | ... example_bugwatch.lastchecked = None |
209 | 752 | ... external_bugtracker.initialize_remote_bugdb_error = error | 752 | ... external_bugtracker.initialize_remote_bugdb_error = error |
210 | 753 | ... try: | 753 | ... try: |
211 | @@ -776,7 +776,7 @@ | |||
212 | 776 | >>> error_utility = CheckWatchesErrorUtility() | 776 | >>> error_utility = CheckWatchesErrorUtility() |
213 | 777 | 777 | ||
214 | 778 | >>> external_bugtracker.initialize_remote_bugdb_error = None | 778 | >>> external_bugtracker.initialize_remote_bugdb_error = None |
216 | 779 | >>> for error in [BugNotFound, InvalidBugId, UnparseableBugData, | 779 | >>> for error in [BugNotFound, InvalidBugId, UnparsableBugData, |
217 | 780 | ... Exception]: | 780 | ... Exception]: |
218 | 781 | ... example_bugwatch.lastchecked = None | 781 | ... example_bugwatch.lastchecked = None |
219 | 782 | ... external_bugtracker.get_remote_status_error = error | 782 | ... external_bugtracker.get_remote_status_error = error |
220 | 783 | 783 | ||
221 | === modified file 'lib/lp/bugs/externalbugtracker/__init__.py' | |||
222 | --- lib/lp/bugs/externalbugtracker/__init__.py 2010-08-20 20:31:18 +0000 | |||
223 | +++ lib/lp/bugs/externalbugtracker/__init__.py 2011-01-19 04:53:42 +0000 | |||
224 | @@ -1,4 +1,4 @@ | |||
226 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
227 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
228 | 3 | 3 | ||
229 | 4 | # pylint: disable-msg=W0401 | 4 | # pylint: disable-msg=W0401 |
230 | @@ -27,8 +27,8 @@ | |||
231 | 27 | 'Trac', | 27 | 'Trac', |
232 | 28 | 'UnknownBugTrackerTypeError', | 28 | 'UnknownBugTrackerTypeError', |
233 | 29 | 'UnknownRemoteStatusError', | 29 | 'UnknownRemoteStatusError', |
236 | 30 | 'UnparseableBugData', | 30 | 'UnparsableBugData', |
237 | 31 | 'UnparseableBugTrackerVersion', | 31 | 'UnparsableBugTrackerVersion', |
238 | 32 | 'UnsupportedBugTrackerVersion', | 32 | 'UnsupportedBugTrackerVersion', |
239 | 33 | 'get_external_bugtracker', | 33 | 'get_external_bugtracker', |
240 | 34 | ] | 34 | ] |
241 | @@ -51,7 +51,7 @@ | |||
242 | 51 | BugTrackerType.TRAC: Trac, | 51 | BugTrackerType.TRAC: Trac, |
243 | 52 | BugTrackerType.ROUNDUP: Roundup, | 52 | BugTrackerType.ROUNDUP: Roundup, |
244 | 53 | BugTrackerType.RT: RequestTracker, | 53 | BugTrackerType.RT: RequestTracker, |
246 | 54 | BugTrackerType.SOURCEFORGE: SourceForge | 54 | BugTrackerType.SOURCEFORGE: SourceForge, |
247 | 55 | } | 55 | } |
248 | 56 | 56 | ||
249 | 57 | 57 | ||
250 | 58 | 58 | ||
251 | === modified file 'lib/lp/bugs/externalbugtracker/base.py' | |||
252 | --- lib/lp/bugs/externalbugtracker/base.py 2011-01-17 23:23:34 +0000 | |||
253 | +++ lib/lp/bugs/externalbugtracker/base.py 2011-01-19 04:53:42 +0000 | |||
254 | @@ -1,4 +1,4 @@ | |||
256 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
257 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
258 | 3 | 3 | ||
259 | 4 | """External bugtrackers.""" | 4 | """External bugtrackers.""" |
260 | @@ -18,8 +18,8 @@ | |||
261 | 18 | 'UnknownBugTrackerTypeError', | 18 | 'UnknownBugTrackerTypeError', |
262 | 19 | 'UnknownRemoteImportanceError', | 19 | 'UnknownRemoteImportanceError', |
263 | 20 | 'UnknownRemoteStatusError', | 20 | 'UnknownRemoteStatusError', |
266 | 21 | 'UnparseableBugData', | 21 | 'UnparsableBugData', |
267 | 22 | 'UnparseableBugTrackerVersion', | 22 | 'UnparsableBugTrackerVersion', |
268 | 23 | 'UnsupportedBugTrackerVersion', | 23 | 'UnsupportedBugTrackerVersion', |
269 | 24 | ] | 24 | ] |
270 | 25 | 25 | ||
271 | @@ -71,11 +71,11 @@ | |||
272 | 71 | """The bug tracker version is not supported.""" | 71 | """The bug tracker version is not supported.""" |
273 | 72 | 72 | ||
274 | 73 | 73 | ||
276 | 74 | class UnparseableBugTrackerVersion(BugWatchUpdateError): | 74 | class UnparsableBugTrackerVersion(BugWatchUpdateError): |
277 | 75 | """The bug tracker version could not be parsed.""" | 75 | """The bug tracker version could not be parsed.""" |
278 | 76 | 76 | ||
279 | 77 | 77 | ||
281 | 78 | class UnparseableBugData(BugWatchUpdateError): | 78 | class UnparsableBugData(BugWatchUpdateError): |
282 | 79 | """The bug tracker provided bug data that could not be parsed.""" | 79 | """The bug tracker provided bug data that could not be parsed.""" |
283 | 80 | 80 | ||
284 | 81 | 81 | ||
285 | @@ -215,7 +215,7 @@ | |||
286 | 215 | 215 | ||
287 | 216 | Raise BugNotFound if the bug can't be found. | 216 | Raise BugNotFound if the bug can't be found. |
288 | 217 | Raise InvalidBugId if the bug id has an unexpected format. | 217 | Raise InvalidBugId if the bug id has an unexpected format. |
290 | 218 | Raise UnparseableBugData if the bug data cannot be parsed. | 218 | Raise UnparsableBugData if the bug data cannot be parsed. |
291 | 219 | """ | 219 | """ |
292 | 220 | # This method should be overridden by subclasses, so we raise a | 220 | # This method should be overridden by subclasses, so we raise a |
293 | 221 | # NotImplementedError if this version of it gets called for some | 221 | # NotImplementedError if this version of it gets called for some |
294 | 222 | 222 | ||
295 | === modified file 'lib/lp/bugs/externalbugtracker/bugzilla.py' | |||
296 | --- lib/lp/bugs/externalbugtracker/bugzilla.py 2011-01-18 21:32:58 +0000 | |||
297 | +++ lib/lp/bugs/externalbugtracker/bugzilla.py 2011-01-19 04:53:42 +0000 | |||
298 | @@ -1,4 +1,4 @@ | |||
300 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
301 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
302 | 3 | 3 | ||
303 | 4 | """Bugzilla ExternalBugTracker utility.""" | 4 | """Bugzilla ExternalBugTracker utility.""" |
304 | @@ -37,8 +37,8 @@ | |||
305 | 37 | LookupTree, | 37 | LookupTree, |
306 | 38 | UnknownRemoteImportanceError, | 38 | UnknownRemoteImportanceError, |
307 | 39 | UnknownRemoteStatusError, | 39 | UnknownRemoteStatusError, |
310 | 40 | UnparseableBugData, | 40 | UnparsableBugData, |
311 | 41 | UnparseableBugTrackerVersion, | 41 | UnparsableBugTrackerVersion, |
312 | 42 | ) | 42 | ) |
313 | 43 | from lp.bugs.externalbugtracker.isolation import ensure_no_transaction | 43 | from lp.bugs.externalbugtracker.isolation import ensure_no_transaction |
314 | 44 | from lp.bugs.externalbugtracker.xmlrpc import UrlLib2Transport | 44 | from lp.bugs.externalbugtracker.xmlrpc import UrlLib2Transport |
315 | @@ -176,7 +176,7 @@ | |||
316 | 176 | """Retrieve and return a remote bugzilla version. | 176 | """Retrieve and return a remote bugzilla version. |
317 | 177 | 177 | ||
318 | 178 | If the version cannot be parsed from the remote server | 178 | If the version cannot be parsed from the remote server |
320 | 179 | `UnparseableBugTrackerVersion` will be raised. If the remote | 179 | `UnparsableBugTrackerVersion` will be raised. If the remote |
321 | 180 | server cannot be reached `BugTrackerConnectError` will be | 180 | server cannot be reached `BugTrackerConnectError` will be |
322 | 181 | raised. | 181 | raised. |
323 | 182 | """ | 182 | """ |
324 | @@ -194,7 +194,7 @@ | |||
325 | 194 | if bugzilla: | 194 | if bugzilla: |
326 | 195 | self.is_issuezilla = True | 195 | self.is_issuezilla = True |
327 | 196 | else: | 196 | else: |
329 | 197 | raise UnparseableBugTrackerVersion( | 197 | raise UnparsableBugTrackerVersion( |
330 | 198 | 'Failed to parse version from xml.cgi for %s: could ' | 198 | 'Failed to parse version from xml.cgi for %s: could ' |
331 | 199 | 'not find top-level bugzilla element' | 199 | 'not find top-level bugzilla element' |
332 | 200 | % self.baseurl) | 200 | % self.baseurl) |
333 | @@ -209,7 +209,7 @@ | |||
334 | 209 | as (2, 15). | 209 | as (2, 15). |
335 | 210 | 210 | ||
336 | 211 | If the passed version is None, None will be returned. | 211 | If the passed version is None, None will be returned. |
338 | 212 | If the version cannot be parsed `UnparseableBugTrackerVersion` | 212 | If the version cannot be parsed `UnparsableBugTrackerVersion` |
339 | 213 | will be raised. | 213 | will be raised. |
340 | 214 | """ | 214 | """ |
341 | 215 | if version is None: | 215 | if version is None: |
342 | @@ -217,7 +217,7 @@ | |||
343 | 217 | 217 | ||
344 | 218 | version_numbers = re.findall('[0-9]+', version) | 218 | version_numbers = re.findall('[0-9]+', version) |
345 | 219 | if len(version_numbers) == 0: | 219 | if len(version_numbers) == 0: |
347 | 220 | raise UnparseableBugTrackerVersion( | 220 | raise UnparsableBugTrackerVersion( |
348 | 221 | 'Failed to parse version %r for %s' % | 221 | 'Failed to parse version %r for %s' % |
349 | 222 | (version, self.baseurl)) | 222 | (version, self.baseurl)) |
350 | 223 | 223 | ||
351 | @@ -310,12 +310,12 @@ | |||
352 | 310 | 310 | ||
353 | 311 | :param document: An `xml.dom.Document` built from a bug search result | 311 | :param document: An `xml.dom.Document` built from a bug search result |
354 | 312 | on the bugzilla instance. | 312 | on the bugzilla instance. |
356 | 313 | :raise UnparseableBugData: If `document` does not appear to be a bug | 313 | :raise UnparsableBugData: If `document` does not appear to be a bug |
357 | 314 | search result. | 314 | search result. |
358 | 315 | """ | 315 | """ |
359 | 316 | root = document.documentElement | 316 | root = document.documentElement |
360 | 317 | if root.tagName == 'html': | 317 | if root.tagName == 'html': |
362 | 318 | raise UnparseableBugData( | 318 | raise UnparsableBugData( |
363 | 319 | "Bug search on %s returned a <%s> instead of an RDF page." % ( | 319 | "Bug search on %s returned a <%s> instead of an RDF page." % ( |
364 | 320 | self.baseurl, root.tagName)) | 320 | self.baseurl, root.tagName)) |
365 | 321 | 321 | ||
366 | @@ -377,8 +377,9 @@ | |||
367 | 377 | try: | 377 | try: |
368 | 378 | document = self._parseDOMString(buglist_xml) | 378 | document = self._parseDOMString(buglist_xml) |
369 | 379 | except xml.parsers.expat.ExpatError, e: | 379 | except xml.parsers.expat.ExpatError, e: |
372 | 380 | raise UnparseableBugData('Failed to parse XML description for ' | 380 | raise UnparsableBugData( |
373 | 381 | '%s bugs %s: %s' % (self.baseurl, bug_ids, e)) | 381 | "Failed to parse XML description for %s bugs %s: %s" |
374 | 382 | % (self.baseurl, bug_ids, e)) | ||
375 | 382 | self._checkBugSearchResult(document) | 383 | self._checkBugSearchResult(document) |
376 | 383 | 384 | ||
377 | 384 | bug_nodes = document.getElementsByTagName(bug_tag) | 385 | bug_nodes = document.getElementsByTagName(bug_tag) |
378 | @@ -678,8 +679,8 @@ | |||
379 | 678 | status = self._bugs[actual_bug_id]['status'] | 679 | status = self._bugs[actual_bug_id]['status'] |
380 | 679 | resolution = self._bugs[actual_bug_id]['resolution'] | 680 | resolution = self._bugs[actual_bug_id]['resolution'] |
381 | 680 | except KeyError: | 681 | except KeyError: |
384 | 681 | raise UnparseableBugData('No status or resolution defined ' | 682 | raise UnparsableBugData( |
385 | 682 | 'for bug %i' % (bug_id)) | 683 | "No status or resolution defined for bug %i" % (bug_id)) |
386 | 683 | 684 | ||
387 | 684 | if resolution != '': | 685 | if resolution != '': |
388 | 685 | return "%s %s" % (status, resolution) | 686 | return "%s %s" % (status, resolution) |
389 | @@ -696,8 +697,8 @@ | |||
390 | 696 | priority = self._bugs[actual_bug_id]['priority'] | 697 | priority = self._bugs[actual_bug_id]['priority'] |
391 | 697 | severity = self._bugs[actual_bug_id]['severity'] | 698 | severity = self._bugs[actual_bug_id]['severity'] |
392 | 698 | except KeyError: | 699 | except KeyError: |
395 | 699 | raise UnparseableBugData('No priority or severity defined ' | 700 | raise UnparsableBugData( |
396 | 700 | 'for bug %i' % (bug_id)) | 701 | "No priority or severity defined for bug %i" % bug_id) |
397 | 701 | 702 | ||
398 | 702 | if severity != '': | 703 | if severity != '': |
399 | 703 | return "%s %s" % (priority, severity) | 704 | return "%s %s" % (priority, severity) |
400 | 704 | 705 | ||
401 | === modified file 'lib/lp/bugs/externalbugtracker/mantis.py' | |||
402 | --- lib/lp/bugs/externalbugtracker/mantis.py 2010-08-24 10:45:57 +0000 | |||
403 | +++ lib/lp/bugs/externalbugtracker/mantis.py 2011-01-19 04:53:42 +0000 | |||
404 | @@ -1,4 +1,4 @@ | |||
406 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
407 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
408 | 3 | 3 | ||
409 | 4 | """Mantis ExternalBugTracker utility.""" | 4 | """Mantis ExternalBugTracker utility.""" |
410 | @@ -28,7 +28,7 @@ | |||
411 | 28 | InvalidBugId, | 28 | InvalidBugId, |
412 | 29 | LookupTree, | 29 | LookupTree, |
413 | 30 | UnknownRemoteStatusError, | 30 | UnknownRemoteStatusError, |
415 | 31 | UnparseableBugData, | 31 | UnparsableBugData, |
416 | 32 | ) | 32 | ) |
417 | 33 | from lp.bugs.externalbugtracker.isolation import ensure_no_transaction | 33 | from lp.bugs.externalbugtracker.isolation import ensure_no_transaction |
418 | 34 | from lp.bugs.interfaces.bugtask import ( | 34 | from lp.bugs.interfaces.bugtask import ( |
419 | @@ -272,7 +272,7 @@ | |||
420 | 272 | csv_data = self.csv_data.strip().split("\r\n0") | 272 | csv_data = self.csv_data.strip().split("\r\n0") |
421 | 273 | 273 | ||
422 | 274 | if not csv_data: | 274 | if not csv_data: |
424 | 275 | raise UnparseableBugData("Empty CSV for %s" % self.baseurl) | 275 | raise UnparsableBugData("Empty CSV for %s" % self.baseurl) |
425 | 276 | 276 | ||
426 | 277 | # Clean out stray, unquoted newlines inside csv_data to avoid | 277 | # Clean out stray, unquoted newlines inside csv_data to avoid |
427 | 278 | # the CSV module blowing up. | 278 | # the CSV module blowing up. |
428 | @@ -284,11 +284,11 @@ | |||
429 | 284 | # ordering and even different columns in the export. | 284 | # ordering and even different columns in the export. |
430 | 285 | self.headers = [h.lower() for h in csv_data.pop(0).split(",")] | 285 | self.headers = [h.lower() for h in csv_data.pop(0).split(",")] |
431 | 286 | if len(self.headers) < 2: | 286 | if len(self.headers) < 2: |
433 | 287 | raise UnparseableBugData("CSV header mangled: %r" % self.headers) | 287 | raise UnparsableBugData("CSV header mangled: %r" % self.headers) |
434 | 288 | 288 | ||
435 | 289 | if not csv_data: | 289 | if not csv_data: |
436 | 290 | # A file with a header and no bugs is also useless. | 290 | # A file with a header and no bugs is also useless. |
438 | 291 | raise UnparseableBugData("CSV for %s contained no bugs!" | 291 | raise UnparsableBugData("CSV for %s contained no bugs!" |
439 | 292 | % self.baseurl) | 292 | % self.baseurl) |
440 | 293 | 293 | ||
441 | 294 | try: | 294 | try: |
442 | @@ -304,8 +304,7 @@ | |||
443 | 304 | return bugs | 304 | return bugs |
444 | 305 | 305 | ||
445 | 306 | except csv.Error, error: | 306 | except csv.Error, error: |
448 | 307 | raise UnparseableBugData( | 307 | raise UnparsableBugData("Exception parsing CSV file: %s." % error) |
447 | 308 | "Exception parsing CSV file: %s." % error) | ||
449 | 309 | 308 | ||
450 | 310 | def _processCSVBugLine(self, bug_line): | 309 | def _processCSVBugLine(self, bug_line): |
451 | 311 | """Processes a single line of the CSV. | 310 | """Processes a single line of the CSV. |
452 | @@ -377,18 +376,16 @@ | |||
453 | 377 | text=lambda node: (node.strip() == key | 376 | text=lambda node: (node.strip() == key |
454 | 378 | and not isinstance(node, Comment))) | 377 | and not isinstance(node, Comment))) |
455 | 379 | if key_node is None: | 378 | if key_node is None: |
458 | 380 | raise UnparseableBugData( | 379 | raise UnparsableBugData("Key %r not found." % (key,)) |
457 | 381 | "Key %r not found." % (key,)) | ||
459 | 382 | 380 | ||
460 | 383 | value_cell = key_node.findNext('td') | 381 | value_cell = key_node.findNext('td') |
461 | 384 | if value_cell is None: | 382 | if value_cell is None: |
463 | 385 | raise UnparseableBugData( | 383 | raise UnparsableBugData( |
464 | 386 | "Value cell for key %r not found." % (key,)) | 384 | "Value cell for key %r not found." % (key,)) |
465 | 387 | 385 | ||
466 | 388 | value_node = value_cell.string | 386 | value_node = value_cell.string |
467 | 389 | if value_node is None: | 387 | if value_node is None: |
470 | 390 | raise UnparseableBugData( | 388 | raise UnparsableBugData("Value for key %r not found." % (key,)) |
469 | 391 | "Value for key %r not found." % (key,)) | ||
471 | 392 | 389 | ||
472 | 393 | return value_node.strip() | 390 | return value_node.strip() |
473 | 394 | 391 | ||
474 | @@ -412,39 +409,35 @@ | |||
475 | 412 | text=lambda node: (node.strip() == key | 409 | text=lambda node: (node.strip() == key |
476 | 413 | and not isinstance(node, Comment))) | 410 | and not isinstance(node, Comment))) |
477 | 414 | if key_node is None: | 411 | if key_node is None: |
480 | 415 | raise UnparseableBugData( | 412 | raise UnparsableBugData("Key %r not found." % (key,)) |
479 | 416 | "Key %r not found." % (key,)) | ||
481 | 417 | 413 | ||
482 | 418 | key_cell = key_node.parent | 414 | key_cell = key_node.parent |
483 | 419 | if key_cell is None: | 415 | if key_cell is None: |
486 | 420 | raise UnparseableBugData( | 416 | raise UnparsableBugData("Cell for key %r not found." % (key,)) |
485 | 421 | "Cell for key %r not found." % (key,)) | ||
487 | 422 | 417 | ||
488 | 423 | key_row = key_cell.parent | 418 | key_row = key_cell.parent |
489 | 424 | if key_row is None: | 419 | if key_row is None: |
492 | 425 | raise UnparseableBugData( | 420 | raise UnparsableBugData("Row for key %r not found." % (key,)) |
491 | 426 | "Row for key %r not found." % (key,)) | ||
493 | 427 | 421 | ||
494 | 428 | try: | 422 | try: |
495 | 429 | key_pos = key_row.findAll('td').index(key_cell) | 423 | key_pos = key_row.findAll('td').index(key_cell) |
496 | 430 | except ValueError: | 424 | except ValueError: |
498 | 431 | raise UnparseableBugData( | 425 | raise UnparsableBugData( |
499 | 432 | "Key cell in row for key %r not found." % (key,)) | 426 | "Key cell in row for key %r not found." % (key,)) |
500 | 433 | 427 | ||
501 | 434 | value_row = key_row.findNextSibling('tr') | 428 | value_row = key_row.findNextSibling('tr') |
502 | 435 | if value_row is None: | 429 | if value_row is None: |
504 | 436 | raise UnparseableBugData( | 430 | raise UnparsableBugData( |
505 | 437 | "Value row for key %r not found." % (key,)) | 431 | "Value row for key %r not found." % (key,)) |
506 | 438 | 432 | ||
507 | 439 | value_cell = value_row.findAll('td')[key_pos] | 433 | value_cell = value_row.findAll('td')[key_pos] |
508 | 440 | if value_cell is None: | 434 | if value_cell is None: |
510 | 441 | raise UnparseableBugData( | 435 | raise UnparsableBugData( |
511 | 442 | "Value cell for key %r not found." % (key,)) | 436 | "Value cell for key %r not found." % (key,)) |
512 | 443 | 437 | ||
513 | 444 | value_node = value_cell.string | 438 | value_node = value_cell.string |
514 | 445 | if value_node is None: | 439 | if value_node is None: |
517 | 446 | raise UnparseableBugData( | 440 | raise UnparsableBugData("Value for key %r not found." % (key,)) |
516 | 447 | "Value for key %r not found." % (key,)) | ||
518 | 448 | 441 | ||
519 | 449 | return value_node.strip() | 442 | return value_node.strip() |
520 | 450 | 443 | ||
521 | 451 | 444 | ||
522 | === modified file 'lib/lp/bugs/externalbugtracker/roundup.py' | |||
523 | --- lib/lp/bugs/externalbugtracker/roundup.py 2010-08-20 20:31:18 +0000 | |||
524 | +++ lib/lp/bugs/externalbugtracker/roundup.py 2011-01-19 04:53:42 +0000 | |||
525 | @@ -1,4 +1,4 @@ | |||
527 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
528 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
529 | 3 | 3 | ||
530 | 4 | """Round ExternalBugTracker utility.""" | 4 | """Round ExternalBugTracker utility.""" |
531 | @@ -17,7 +17,7 @@ | |||
532 | 17 | InvalidBugId, | 17 | InvalidBugId, |
533 | 18 | LookupTree, | 18 | LookupTree, |
534 | 19 | UnknownRemoteStatusError, | 19 | UnknownRemoteStatusError, |
536 | 20 | UnparseableBugData, | 20 | UnparsableBugData, |
537 | 21 | ) | 21 | ) |
538 | 22 | from lp.bugs.interfaces.bugtask import ( | 22 | from lp.bugs.interfaces.bugtask import ( |
539 | 23 | BugTaskImportance, | 23 | BugTaskImportance, |
540 | @@ -263,7 +263,7 @@ | |||
541 | 263 | if field in remote_bug: | 263 | if field in remote_bug: |
542 | 264 | field_values.append(remote_bug[field]) | 264 | field_values.append(remote_bug[field]) |
543 | 265 | else: | 265 | else: |
545 | 266 | raise UnparseableBugData( | 266 | raise UnparsableBugData( |
546 | 267 | "Remote bug %s does not define a value for %s." % ( | 267 | "Remote bug %s does not define a value for %s." % ( |
547 | 268 | bug_id, field)) | 268 | bug_id, field)) |
548 | 269 | 269 | ||
549 | 270 | 270 | ||
550 | === modified file 'lib/lp/bugs/externalbugtracker/sourceforge.py' | |||
551 | --- lib/lp/bugs/externalbugtracker/sourceforge.py 2010-08-20 20:31:18 +0000 | |||
552 | +++ lib/lp/bugs/externalbugtracker/sourceforge.py 2011-01-19 04:53:42 +0000 | |||
553 | @@ -1,4 +1,4 @@ | |||
555 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
556 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
557 | 3 | 3 | ||
558 | 4 | """Sourceforge ExternalBugTracker utility.""" | 4 | """Sourceforge ExternalBugTracker utility.""" |
559 | @@ -19,7 +19,7 @@ | |||
560 | 19 | LookupTree, | 19 | LookupTree, |
561 | 20 | PrivateRemoteBug, | 20 | PrivateRemoteBug, |
562 | 21 | UnknownRemoteStatusError, | 21 | UnknownRemoteStatusError, |
564 | 22 | UnparseableBugData, | 22 | UnparsableBugData, |
565 | 23 | ) | 23 | ) |
566 | 24 | from lp.bugs.interfaces.bugtask import ( | 24 | from lp.bugs.interfaces.bugtask import ( |
567 | 25 | BugTaskImportance, | 25 | BugTaskImportance, |
568 | @@ -77,7 +77,7 @@ | |||
569 | 77 | else: | 77 | else: |
570 | 78 | # If we can't find a status line in the output from | 78 | # If we can't find a status line in the output from |
571 | 79 | # SourceForge there's little point in continuing. | 79 | # SourceForge there's little point in continuing. |
573 | 80 | raise UnparseableBugData( | 80 | raise UnparsableBugData( |
574 | 81 | 'Remote bug %s does not define a status.' % bug_id) | 81 | 'Remote bug %s does not define a status.' % bug_id) |
575 | 82 | 82 | ||
576 | 83 | # We need to do the same for Resolution, though if we can't | 83 | # We need to do the same for Resolution, though if we can't |
577 | @@ -176,7 +176,7 @@ | |||
578 | 176 | try: | 176 | try: |
579 | 177 | return '%(status)s:%(resolution)s' % remote_bug | 177 | return '%(status)s:%(resolution)s' % remote_bug |
580 | 178 | except KeyError: | 178 | except KeyError: |
582 | 179 | raise UnparseableBugData( | 179 | raise UnparsableBugData( |
583 | 180 | "Remote bug %i does not define a status." % bug_id) | 180 | "Remote bug %i does not define a status." % bug_id) |
584 | 181 | 181 | ||
585 | 182 | def convertRemoteImportance(self, remote_importance): | 182 | def convertRemoteImportance(self, remote_importance): |
586 | @@ -266,4 +266,3 @@ | |||
587 | 266 | return None | 266 | return None |
588 | 267 | else: | 267 | else: |
589 | 268 | return "%s&%s" % (group_id, atid) | 268 | return "%s&%s" % (group_id, atid) |
590 | 269 | |||
591 | 270 | 269 | ||
592 | === modified file 'lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py' | |||
593 | --- lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py 2011-01-18 20:46:11 +0000 | |||
594 | +++ lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py 2011-01-19 04:53:42 +0000 | |||
595 | @@ -1,4 +1,4 @@ | |||
597 | 1 | # Copyright 2010 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2010-2011 Canonical Ltd. This software is licensed under the |
598 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
599 | 3 | 3 | ||
600 | 4 | """Tests for the Bugzilla BugTracker.""" | 4 | """Tests for the Bugzilla BugTracker.""" |
601 | @@ -8,7 +8,7 @@ | |||
602 | 8 | from StringIO import StringIO | 8 | from StringIO import StringIO |
603 | 9 | 9 | ||
604 | 10 | from canonical.testing.layers import DatabaseFunctionalLayer | 10 | from canonical.testing.layers import DatabaseFunctionalLayer |
606 | 11 | from lp.bugs.externalbugtracker.base import UnparseableBugData | 11 | from lp.bugs.externalbugtracker.base import UnparsableBugData |
607 | 12 | from lp.bugs.externalbugtracker.bugzilla import Bugzilla | 12 | from lp.bugs.externalbugtracker.bugzilla import Bugzilla |
608 | 13 | from lp.testing import TestCaseWithFactory | 13 | from lp.testing import TestCaseWithFactory |
609 | 14 | from lp.testing.fakemethod import FakeMethod | 14 | from lp.testing.fakemethod import FakeMethod |
610 | @@ -54,4 +54,4 @@ | |||
611 | 54 | </html> | 54 | </html> |
612 | 55 | """ | 55 | """ |
613 | 56 | bugzilla = self._makeInstrumentedBugzilla(content=result_text) | 56 | bugzilla = self._makeInstrumentedBugzilla(content=result_text) |
615 | 57 | self.assertRaises(UnparseableBugData, bugzilla.getRemoteBugBatch, []) | 57 | self.assertRaises(UnparsableBugData, bugzilla.getRemoteBugBatch, []) |
616 | 58 | 58 | ||
617 | === modified file 'lib/lp/bugs/externalbugtracker/trac.py' | |||
618 | --- lib/lp/bugs/externalbugtracker/trac.py 2010-11-10 09:28:09 +0000 | |||
619 | +++ lib/lp/bugs/externalbugtracker/trac.py 2011-01-19 04:53:42 +0000 | |||
620 | @@ -1,4 +1,4 @@ | |||
622 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the |
623 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
624 | 3 | 3 | ||
625 | 4 | """Trac ExternalBugTracker implementation.""" | 4 | """Trac ExternalBugTracker implementation.""" |
626 | @@ -30,7 +30,7 @@ | |||
627 | 30 | InvalidBugId, | 30 | InvalidBugId, |
628 | 31 | LookupTree, | 31 | LookupTree, |
629 | 32 | UnknownRemoteStatusError, | 32 | UnknownRemoteStatusError, |
631 | 33 | UnparseableBugData, | 33 | UnparsableBugData, |
632 | 34 | ) | 34 | ) |
633 | 35 | from lp.bugs.externalbugtracker.isolation import ensure_no_transaction | 35 | from lp.bugs.externalbugtracker.isolation import ensure_no_transaction |
634 | 36 | from lp.bugs.externalbugtracker.xmlrpc import UrlLib2Transport | 36 | from lp.bugs.externalbugtracker.xmlrpc import UrlLib2Transport |
635 | @@ -143,13 +143,13 @@ | |||
636 | 143 | # We consider the data we're getting from the remote server to | 143 | # We consider the data we're getting from the remote server to |
637 | 144 | # be valid if there is an ID field and a status field in the CSV | 144 | # be valid if there is an ID field and a status field in the CSV |
638 | 145 | # header. If the fields don't exist we raise an | 145 | # header. If the fields don't exist we raise an |
640 | 146 | # UnparseableBugData error. If these fields are defined but not | 146 | # UnparsableBugData error. If these fields are defined but not |
641 | 147 | # filled in for each row, that error will be handled in | 147 | # filled in for each row, that error will be handled in |
642 | 148 | # getRemoteBugStatus() (i.e. with a BugNotFound or an | 148 | # getRemoteBugStatus() (i.e. with a BugNotFound or an |
643 | 149 | # UnknownRemoteStatusError). | 149 | # UnknownRemoteStatusError). |
644 | 150 | if ('id' not in csv_reader.fieldnames or | 150 | if ('id' not in csv_reader.fieldnames or |
645 | 151 | 'status' not in csv_reader.fieldnames): | 151 | 'status' not in csv_reader.fieldnames): |
647 | 152 | raise UnparseableBugData( | 152 | raise UnparsableBugData( |
648 | 153 | "External bugtracker %s does not define all the necessary " | 153 | "External bugtracker %s does not define all the necessary " |
649 | 154 | "fields for bug status imports (Defined field names: %r)." | 154 | "fields for bug status imports (Defined field names: %r)." |
650 | 155 | % (self.baseurl, csv_reader.fieldnames)) | 155 | % (self.baseurl, csv_reader.fieldnames)) |
651 | @@ -169,7 +169,7 @@ | |||
652 | 169 | # There should be only one bug returned for a getRemoteBug() | 169 | # There should be only one bug returned for a getRemoteBug() |
653 | 170 | # call, so if we have more or less than one bug something went | 170 | # call, so if we have more or less than one bug something went |
654 | 171 | # wrong. | 171 | # wrong. |
656 | 172 | raise UnparseableBugData( | 172 | raise UnparsableBugData( |
657 | 173 | "Remote bugtracker %s returned wrong amount of data for bug " | 173 | "Remote bugtracker %s returned wrong amount of data for bug " |
658 | 174 | "%i (expected 1 bug, got %i bugs)." % | 174 | "%i (expected 1 bug, got %i bugs)." % |
659 | 175 | (self.baseurl, bug_id, len(bug_data))) | 175 | (self.baseurl, bug_id, len(bug_data))) |
660 | @@ -248,7 +248,7 @@ | |||
661 | 248 | 248 | ||
662 | 249 | # If the bug has a valid resolution as well as a status then we return | 249 | # If the bug has a valid resolution as well as a status then we return |
663 | 250 | # that, since it's more informative than the status field on its own. | 250 | # that, since it's more informative than the status field on its own. |
665 | 251 | if (remote_bug.has_key('resolution') and | 251 | if ('resolution' in remote_bug and |
666 | 252 | remote_bug['resolution'] not in ['', '--', None]): | 252 | remote_bug['resolution'] not in ['', '--', None]): |
667 | 253 | return remote_bug['resolution'] | 253 | return remote_bug['resolution'] |
668 | 254 | else: | 254 | else: |
669 | @@ -295,6 +295,7 @@ | |||
670 | 295 | If an `xmlrpclib.ProtocolError` with error code 403 is raised by the | 295 | If an `xmlrpclib.ProtocolError` with error code 403 is raised by the |
671 | 296 | function, we'll try to authenticate and call the function again. | 296 | function, we'll try to authenticate and call the function again. |
672 | 297 | """ | 297 | """ |
673 | 298 | |||
674 | 298 | def decorator(self, *args, **kwargs): | 299 | def decorator(self, *args, **kwargs): |
675 | 299 | try: | 300 | try: |
676 | 300 | return func(self, *args, **kwargs) | 301 | return func(self, *args, **kwargs) |
677 | @@ -401,7 +402,8 @@ | |||
678 | 401 | # We retrieve only the IDs of the modified bugs from the server. | 402 | # We retrieve only the IDs of the modified bugs from the server. |
679 | 402 | criteria = { | 403 | criteria = { |
680 | 403 | 'modified_since': last_checked_timestamp, | 404 | 'modified_since': last_checked_timestamp, |
682 | 404 | 'bugs': remote_bug_ids,} | 405 | 'bugs': remote_bug_ids, |
683 | 406 | } | ||
684 | 405 | time_snapshot, modified_bugs = self._server.launchpad.bug_info( | 407 | time_snapshot, modified_bugs = self._server.launchpad.bug_info( |
685 | 406 | LP_PLUGIN_BUG_IDS_ONLY, criteria) | 408 | LP_PLUGIN_BUG_IDS_ONLY, criteria) |
686 | 407 | 409 | ||
687 | 408 | 410 | ||
688 | === modified file 'lib/lp/bugs/scripts/checkwatches/utilities.py' | |||
689 | --- lib/lp/bugs/scripts/checkwatches/utilities.py 2010-08-20 20:31:18 +0000 | |||
690 | +++ lib/lp/bugs/scripts/checkwatches/utilities.py 2011-01-19 04:53:42 +0000 | |||
691 | @@ -1,4 +1,4 @@ | |||
693 | 1 | # Copyright 2010 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2010-2011 Canonical Ltd. This software is licensed under the |
694 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
695 | 3 | 3 | ||
696 | 4 | """Utility functions for checkwatches.""" | 4 | """Utility functions for checkwatches.""" |
697 | @@ -17,8 +17,8 @@ | |||
698 | 17 | InvalidBugId, | 17 | InvalidBugId, |
699 | 18 | PrivateRemoteBug, | 18 | PrivateRemoteBug, |
700 | 19 | UnknownBugTrackerTypeError, | 19 | UnknownBugTrackerTypeError, |
703 | 20 | UnparseableBugData, | 20 | UnparsableBugData, |
704 | 21 | UnparseableBugTrackerVersion, | 21 | UnparsableBugTrackerVersion, |
705 | 22 | UnsupportedBugTrackerVersion, | 22 | UnsupportedBugTrackerVersion, |
706 | 23 | ) | 23 | ) |
707 | 24 | from lp.bugs.interfaces.bugwatch import BugWatchActivityStatus | 24 | from lp.bugs.interfaces.bugwatch import BugWatchActivityStatus |
708 | @@ -27,8 +27,8 @@ | |||
709 | 27 | _exception_to_bugwatcherrortype = [ | 27 | _exception_to_bugwatcherrortype = [ |
710 | 28 | (BugTrackerConnectError, BugWatchActivityStatus.CONNECTION_ERROR), | 28 | (BugTrackerConnectError, BugWatchActivityStatus.CONNECTION_ERROR), |
711 | 29 | (PrivateRemoteBug, BugWatchActivityStatus.PRIVATE_REMOTE_BUG), | 29 | (PrivateRemoteBug, BugWatchActivityStatus.PRIVATE_REMOTE_BUG), |
714 | 30 | (UnparseableBugData, BugWatchActivityStatus.UNPARSABLE_BUG), | 30 | (UnparsableBugData, BugWatchActivityStatus.UNPARSABLE_BUG), |
715 | 31 | (UnparseableBugTrackerVersion, | 31 | (UnparsableBugTrackerVersion, |
716 | 32 | BugWatchActivityStatus.UNPARSABLE_BUG_TRACKER), | 32 | BugWatchActivityStatus.UNPARSABLE_BUG_TRACKER), |
717 | 33 | (UnsupportedBugTrackerVersion, | 33 | (UnsupportedBugTrackerVersion, |
718 | 34 | BugWatchActivityStatus.UNSUPPORTED_BUG_TRACKER), | 34 | BugWatchActivityStatus.UNSUPPORTED_BUG_TRACKER), |
719 | @@ -62,5 +62,5 @@ | |||
720 | 62 | ('batch_query_threshold', remote_system.batch_query_threshold), | 62 | ('batch_query_threshold', remote_system.batch_query_threshold), |
721 | 63 | ('sync_comments', remote_system.sync_comments), | 63 | ('sync_comments', remote_system.sync_comments), |
722 | 64 | ('externalbugtracker', remote_system.__class__.__name__), | 64 | ('externalbugtracker', remote_system.__class__.__name__), |
724 | 65 | ('baseurl', remote_system.baseurl) | 65 | ('baseurl', remote_system.baseurl), |
725 | 66 | ] | 66 | ] |
726 | 67 | 67 | ||
727 | === modified file 'lib/lp/code/errors.py' | |||
728 | --- lib/lp/code/errors.py 2010-11-12 23:30:57 +0000 | |||
729 | +++ lib/lp/code/errors.py 2011-01-19 04:53:42 +0000 | |||
730 | @@ -182,7 +182,7 @@ | |||
731 | 182 | class InvalidNamespace(Exception): | 182 | class InvalidNamespace(Exception): |
732 | 183 | """Raised when someone tries to lookup a namespace with a bad name. | 183 | """Raised when someone tries to lookup a namespace with a bad name. |
733 | 184 | 184 | ||
735 | 185 | By 'bad', we mean that the name is unparseable. It might be too short, too | 185 | By 'bad', we mean that the name is unparsable. It might be too short, too |
736 | 186 | long or malformed in some other way. | 186 | long or malformed in some other way. |
737 | 187 | """ | 187 | """ |
738 | 188 | 188 |
Woohoo!