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