Merge lp:~jtv/launchpad/bug-228940 into lp:launchpad

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
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/Unparsable/g

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.
Revision history for this message
Graham Binns (gmb) wrote :

Woohoo!

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt'
--- lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt 2010-10-18 22:24:59 +0000
+++ lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt 2011-01-19 04:53:42 +0000
@@ -280,14 +280,14 @@
280 BugNotFound: no-such-bug280 BugNotFound: no-such-bug
281281
282If the data we've imported from Bugzilla is incomplete and doesn't282If the data we've imported from Bugzilla is incomplete and doesn't
283contain either the bug's status or its resolution an UnparseableBugData283contain either the bug's status or its resolution an UnparsableBugData
284error will be raised. We can add a sample bug to demonstrate this.284error will be raised. We can add a sample bug to demonstrate this.
285285
286 >>> bugzilla._bugs[999] = {}286 >>> bugzilla._bugs[999] = {}
287 >>> bugzilla.getRemoteStatus(999)287 >>> bugzilla.getRemoteStatus(999)
288 Traceback (most recent call last):288 Traceback (most recent call last):
289 ...289 ...
290 UnparseableBugData: No status or resolution defined for bug 999290 UnparsableBugData: No status or resolution defined for bug 999
291291
292 >>> del bugzilla._bugs[999]292 >>> del bugzilla._bugs[999]
293293
@@ -338,7 +338,7 @@
338 ... print " %s: %s" % (key, bugzilla._bugs[bug][key])338 ... print " %s: %s" % (key, bugzilla._bugs[bug][key])
339 ... print "\n"339 ... print "\n"
340 Bug 1:340 Bug 1:
341 alias: 341 alias:
342 assigned_to: test@canonical.com...342 assigned_to: test@canonical.com...
343 Bug 2:343 Bug 2:
344 alias: bug-two344 alias: bug-two
@@ -387,7 +387,8 @@
387instance.387instance.
388388
389 >>> from canonical.launchpad.webapp.testing import verifyObject389 >>> from canonical.launchpad.webapp.testing import verifyObject
390 >>> from lp.bugs.interfaces.externalbugtracker import ISupportsCommentImport390 >>> from lp.bugs.interfaces.externalbugtracker import (
391 ... ISupportsCommentImport)
391 >>> verifyObject(ISupportsCommentImport, bugzilla)392 >>> verifyObject(ISupportsCommentImport, bugzilla)
392 True393 True
393394
394395
=== modified file 'lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt'
--- lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt 2010-10-18 22:24:59 +0000
+++ lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt 2011-01-19 04:53:42 +0000
@@ -25,8 +25,8 @@
25 >>> for bug_watch in mozilla_bugzilla.watches:25 >>> for bug_watch in mozilla_bugzilla.watches:
26 ... print "%s: %s %s" % (bug_watch.remotebug,26 ... print "%s: %s %s" % (bug_watch.remotebug,
27 ... bug_watch.remotestatus, bug_watch.remote_importance)27 ... bug_watch.remotestatus, bug_watch.remote_importance)
28 2000: 28 2000:
29 123543: 29 123543:
30 42: FUBAR BAZBAZ30 42: FUBAR BAZBAZ
31 42: FUBAR BAZBAZ31 42: FUBAR BAZBAZ
32 >>> transaction.commit()32 >>> transaction.commit()
@@ -136,5 +136,5 @@
136 >>> broken_bugzilla.initializeRemoteBugDB(remote_bugs)136 >>> broken_bugzilla.initializeRemoteBugDB(remote_bugs)
137 Traceback (most recent call last):137 Traceback (most recent call last):
138 ...138 ...
139 UnparseableBugData: Failed to parse XML description...139 UnparsableBugData: Failed to parse XML description...
140140
141141
=== modified file 'lib/lp/bugs/doc/externalbugtracker-bugzilla.txt'
--- lib/lp/bugs/doc/externalbugtracker-bugzilla.txt 2011-01-18 18:36:49 +0000
+++ lib/lp/bugs/doc/externalbugtracker-bugzilla.txt 2011-01-19 04:53:42 +0000
@@ -22,14 +22,14 @@
2222
23The Bugzilla ExternalBugTracker works differently depending on which23The Bugzilla ExternalBugTracker works differently depending on which
24version of Bugzilla it is talking to. If it's a version we can't parse,24version of Bugzilla it is talking to. If it's a version we can't parse,
25UnparseableBugTrackerVersion is raised:25UnparsableBugTrackerVersion is raised:
2626
27 >>> from canonical.testing.layers import LaunchpadZopelessLayer27 >>> from canonical.testing.layers import LaunchpadZopelessLayer
28 >>> txn = LaunchpadZopelessLayer.txn28 >>> txn = LaunchpadZopelessLayer.txn
29 >>> external_bugzilla = Bugzilla('http://example.com/', version='A.B')29 >>> external_bugzilla = Bugzilla('http://example.com/', version='A.B')
30 Traceback (most recent call last):30 Traceback (most recent call last):
31 ...31 ...
32 UnparseableBugTrackerVersion:32 UnparsableBugTrackerVersion:
33 Failed to parse version 'A.B' for http://...33 Failed to parse version 'A.B' for http://...
3434
35The version parsing is carried out by the Bugzilla._parseVersion()35The version parsing is carried out by the Bugzilla._parseVersion()
@@ -669,7 +669,7 @@
669 ... external_bugzilla, [bug_watch1, bug_watch2])669 ... external_bugzilla, [bug_watch1, bug_watch2])
670 Traceback (most recent call last):670 Traceback (most recent call last):
671 ...671 ...
672 UnparseableBugData:672 UnparsableBugData:
673 Failed to parse XML description for https://bugzilla.mozilla.org...673 Failed to parse XML description for https://bugzilla.mozilla.org...
674674
675The error is also recorded in each bug watch's last_error_type field so that675The error is also recorded in each bug watch's last_error_type field so that
676676
=== modified file 'lib/lp/bugs/doc/externalbugtracker-sourceforge.txt'
--- lib/lp/bugs/doc/externalbugtracker-sourceforge.txt 2010-10-18 22:24:59 +0000
+++ lib/lp/bugs/doc/externalbugtracker-sourceforge.txt 2011-01-19 04:53:42 +0000
@@ -96,7 +96,7 @@
96 >>> sourceforge.initializeRemoteBugDB([0])96 >>> sourceforge.initializeRemoteBugDB([0])
97 Traceback (most recent call last):97 Traceback (most recent call last):
98 ...98 ...
99 UnparseableBugData: Remote bug 0 does not define a status.99 UnparsableBugData: Remote bug 0 does not define a status.
100100
101Some SourceForge bugs are marked private. Although we can't import a101Some SourceForge bugs are marked private. Although we can't import a
102status from them, we don't raise an error when trying to initialize the102status from them, we don't raise an error when trying to initialize the
@@ -141,7 +141,8 @@
141Launchpad.dev bug #10 is the same bug as reported in example.com bug141Launchpad.dev bug #10 is the same bug as reported in example.com bug
142#1722250, so we add a watch against the remote bug.142#1722250, so we add a watch against the remote bug.
143143
144 >>> from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities144 >>> from canonical.launchpad.interfaces.launchpad import (
145 ... ILaunchpadCelebrities)
145 >>> from lp.registry.interfaces.person import IPersonSet146 >>> from lp.registry.interfaces.person import IPersonSet
146 >>> from lp.bugs.tests.externalbugtracker import (147 >>> from lp.bugs.tests.externalbugtracker import (
147 ... new_bugtracker)148 ... new_bugtracker)
148149
=== modified file 'lib/lp/bugs/doc/externalbugtracker-trac.txt'
--- lib/lp/bugs/doc/externalbugtracker-trac.txt 2010-11-10 09:28:09 +0000
+++ lib/lp/bugs/doc/externalbugtracker-trac.txt 2011-01-19 04:53:42 +0000
@@ -157,7 +157,7 @@
157remote bug IDs will fetch those bug IDs from the server and file them in a157remote bug IDs will fetch those bug IDs from the server and file them in a
158local variable for later use.158local variable for later use.
159159
160We use a test-oriented implementation for the purposes of these tests, which 160We use a test-oriented implementation for the purposes of these tests, which
161overrides ExternalBugTracker.urlopen() so that we don't have to rely on a161overrides ExternalBugTracker.urlopen() so that we don't have to rely on a
162working network connection.162working network connection.
163163
@@ -208,7 +208,7 @@
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')
209209
210If, when using the batch export method, the Trac instance comes across210If, when using the batch export method, the Trac instance comes across
211invalid data, it will raise an UnparseableBugData exception. We will211invalid data, it will raise an UnparsableBugData exception. We will
212force our trac instance to use invalid data for the purposes of this212force our trac instance to use invalid data for the purposes of this
213test.213test.
214214
@@ -216,7 +216,7 @@
216 >>> trac.initializeRemoteBugDB([6, 7, 8, 9, 10])216 >>> trac.initializeRemoteBugDB([6, 7, 8, 9, 10])
217 Traceback (most recent call last):217 Traceback (most recent call last):
218 ...218 ...
219 UnparseableBugData: External bugtracker http://test.trac does not219 UnparsableBugData: External bugtracker http://test.trac does not
220 define all the necessary fields for bug status imports (Defined220 define all the necessary fields for bug status imports (Defined
221 field names: ['<html>']).221 field names: ['<html>']).
222222
@@ -226,7 +226,7 @@
226 >>> trac.initializeRemoteBugDB([6])226 >>> trac.initializeRemoteBugDB([6])
227 Traceback (most recent call last):227 Traceback (most recent call last):
228 ...228 ...
229 UnparseableBugData: External bugtracker http://test.trac does not229 UnparsableBugData: External bugtracker http://test.trac does not
230 define all the necessary fields for bug status imports (Defined230 define all the necessary fields for bug status imports (Defined
231 field names: ['<html>']).231 field names: ['<html>']).
232232
@@ -261,13 +261,13 @@
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]
262262
263If _fetchBugData() receives a response that isn't a valid Trac CSV263If _fetchBugData() receives a response that isn't a valid Trac CSV
264export, it will raise an UnparseableBugData error.264export, it will raise an UnparsableBugData error.
265265
266 >>> trac.csv_export_file = 'trac_example_broken_ticket_export.csv'266 >>> trac.csv_export_file = 'trac_example_broken_ticket_export.csv'
267 >>> trac._fetchBugData(query_url)267 >>> trac._fetchBugData(query_url)
268 Traceback (most recent call last):268 Traceback (most recent call last):
269 ...269 ...
270 UnparseableBugData: External bugtracker http://test.trac does not270 UnparsableBugData: External bugtracker http://test.trac does not
271 define all the necessary fields for bug status imports (Defined271 define all the necessary fields for bug status imports (Defined
272 field names: ['<html>']).272 field names: ['<html>']).
273273
@@ -279,11 +279,13 @@
279 >>> from lp.bugs.interfaces.bug import IBugSet279 >>> from lp.bugs.interfaces.bug import IBugSet
280 >>> from lp.registry.interfaces.person import IPersonSet280 >>> from lp.registry.interfaces.person import IPersonSet
281281
282 >>> sample_person = getUtility(IPersonSet).getByEmail('test@canonical.com')282 >>> sample_person = getUtility(IPersonSet).getByEmail(
283 ... 'test@canonical.com')
283284
284 >>> example_bug_tracker = new_bugtracker(BugTrackerType.TRAC)285 >>> example_bug_tracker = new_bugtracker(BugTrackerType.TRAC)
285286
286 >>> from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities287 >>> from canonical.launchpad.interfaces.launchpad import (
288 ... ILaunchpadCelebrities)
287 >>> example_bug = getUtility(IBugSet).get(10)289 >>> example_bug = getUtility(IBugSet).get(10)
288 >>> example_bugwatch = example_bug.addWatch(290 >>> example_bugwatch = example_bug.addWatch(
289 ... example_bug_tracker, '1',291 ... example_bug_tracker, '1',
290292
=== modified file 'lib/lp/bugs/doc/externalbugtracker.txt'
--- lib/lp/bugs/doc/externalbugtracker.txt 2010-12-20 03:21:03 +0000
+++ lib/lp/bugs/doc/externalbugtracker.txt 2011-01-19 04:53:42 +0000
@@ -730,7 +730,7 @@
730730
731 >>> from lp.bugs.externalbugtracker import (731 >>> from lp.bugs.externalbugtracker import (
732 ... BugNotFound, BugTrackerConnectError, InvalidBugId,732 ... BugNotFound, BugTrackerConnectError, InvalidBugId,
733 ... UnparseableBugData, UnparseableBugTrackerVersion)733 ... UnparsableBugData, UnparsableBugTrackerVersion)
734734
735TestBrokenExternalBugTracker allows us to force errors to occur, so we735TestBrokenExternalBugTracker allows us to force errors to occur, so we
736can use it to check that bug watches' last_error_types are being set736can use it to check that bug watches' last_error_types are being set
@@ -746,8 +746,8 @@
746checkwatches ran instead of just once every 24 hours like any other bug746checkwatches ran instead of just once every 24 hours like any other bug
747watch.747watch.
748748
749 >>> for error in [BugTrackerConnectError, UnparseableBugData,749 >>> for error in [BugTrackerConnectError, UnparsableBugData,
750 ... UnparseableBugTrackerVersion, Exception]:750 ... UnparsableBugTrackerVersion, Exception]:
751 ... example_bugwatch.lastchecked = None751 ... example_bugwatch.lastchecked = None
752 ... external_bugtracker.initialize_remote_bugdb_error = error752 ... external_bugtracker.initialize_remote_bugdb_error = error
753 ... try:753 ... try:
@@ -776,7 +776,7 @@
776 >>> error_utility = CheckWatchesErrorUtility()776 >>> error_utility = CheckWatchesErrorUtility()
777777
778 >>> external_bugtracker.initialize_remote_bugdb_error = None778 >>> external_bugtracker.initialize_remote_bugdb_error = None
779 >>> for error in [BugNotFound, InvalidBugId, UnparseableBugData,779 >>> for error in [BugNotFound, InvalidBugId, UnparsableBugData,
780 ... Exception]:780 ... Exception]:
781 ... example_bugwatch.lastchecked = None781 ... example_bugwatch.lastchecked = None
782 ... external_bugtracker.get_remote_status_error = error782 ... external_bugtracker.get_remote_status_error = error
783783
=== modified file 'lib/lp/bugs/externalbugtracker/__init__.py'
--- lib/lp/bugs/externalbugtracker/__init__.py 2010-08-20 20:31:18 +0000
+++ lib/lp/bugs/externalbugtracker/__init__.py 2011-01-19 04:53:42 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4# pylint: disable-msg=W04014# pylint: disable-msg=W0401
@@ -27,8 +27,8 @@
27 'Trac',27 'Trac',
28 'UnknownBugTrackerTypeError',28 'UnknownBugTrackerTypeError',
29 'UnknownRemoteStatusError',29 'UnknownRemoteStatusError',
30 'UnparseableBugData',30 'UnparsableBugData',
31 'UnparseableBugTrackerVersion',31 'UnparsableBugTrackerVersion',
32 'UnsupportedBugTrackerVersion',32 'UnsupportedBugTrackerVersion',
33 'get_external_bugtracker',33 'get_external_bugtracker',
34 ]34 ]
@@ -51,7 +51,7 @@
51 BugTrackerType.TRAC: Trac,51 BugTrackerType.TRAC: Trac,
52 BugTrackerType.ROUNDUP: Roundup,52 BugTrackerType.ROUNDUP: Roundup,
53 BugTrackerType.RT: RequestTracker,53 BugTrackerType.RT: RequestTracker,
54 BugTrackerType.SOURCEFORGE: SourceForge54 BugTrackerType.SOURCEFORGE: SourceForge,
55 }55 }
5656
5757
5858
=== modified file 'lib/lp/bugs/externalbugtracker/base.py'
--- lib/lp/bugs/externalbugtracker/base.py 2011-01-17 23:23:34 +0000
+++ lib/lp/bugs/externalbugtracker/base.py 2011-01-19 04:53:42 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""External bugtrackers."""4"""External bugtrackers."""
@@ -18,8 +18,8 @@
18 'UnknownBugTrackerTypeError',18 'UnknownBugTrackerTypeError',
19 'UnknownRemoteImportanceError',19 'UnknownRemoteImportanceError',
20 'UnknownRemoteStatusError',20 'UnknownRemoteStatusError',
21 'UnparseableBugData',21 'UnparsableBugData',
22 'UnparseableBugTrackerVersion',22 'UnparsableBugTrackerVersion',
23 'UnsupportedBugTrackerVersion',23 'UnsupportedBugTrackerVersion',
24 ]24 ]
2525
@@ -71,11 +71,11 @@
71 """The bug tracker version is not supported."""71 """The bug tracker version is not supported."""
7272
7373
74class UnparseableBugTrackerVersion(BugWatchUpdateError):74class UnparsableBugTrackerVersion(BugWatchUpdateError):
75 """The bug tracker version could not be parsed."""75 """The bug tracker version could not be parsed."""
7676
7777
78class UnparseableBugData(BugWatchUpdateError):78class UnparsableBugData(BugWatchUpdateError):
79 """The bug tracker provided bug data that could not be parsed."""79 """The bug tracker provided bug data that could not be parsed."""
8080
8181
@@ -215,7 +215,7 @@
215215
216 Raise BugNotFound if the bug can't be found.216 Raise BugNotFound if the bug can't be found.
217 Raise InvalidBugId if the bug id has an unexpected format.217 Raise InvalidBugId if the bug id has an unexpected format.
218 Raise UnparseableBugData if the bug data cannot be parsed.218 Raise UnparsableBugData if the bug data cannot be parsed.
219 """219 """
220 # This method should be overridden by subclasses, so we raise a220 # This method should be overridden by subclasses, so we raise a
221 # NotImplementedError if this version of it gets called for some221 # NotImplementedError if this version of it gets called for some
222222
=== modified file 'lib/lp/bugs/externalbugtracker/bugzilla.py'
--- lib/lp/bugs/externalbugtracker/bugzilla.py 2011-01-18 21:32:58 +0000
+++ lib/lp/bugs/externalbugtracker/bugzilla.py 2011-01-19 04:53:42 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Bugzilla ExternalBugTracker utility."""4"""Bugzilla ExternalBugTracker utility."""
@@ -37,8 +37,8 @@
37 LookupTree,37 LookupTree,
38 UnknownRemoteImportanceError,38 UnknownRemoteImportanceError,
39 UnknownRemoteStatusError,39 UnknownRemoteStatusError,
40 UnparseableBugData,40 UnparsableBugData,
41 UnparseableBugTrackerVersion,41 UnparsableBugTrackerVersion,
42 )42 )
43from lp.bugs.externalbugtracker.isolation import ensure_no_transaction43from lp.bugs.externalbugtracker.isolation import ensure_no_transaction
44from lp.bugs.externalbugtracker.xmlrpc import UrlLib2Transport44from lp.bugs.externalbugtracker.xmlrpc import UrlLib2Transport
@@ -176,7 +176,7 @@
176 """Retrieve and return a remote bugzilla version.176 """Retrieve and return a remote bugzilla version.
177177
178 If the version cannot be parsed from the remote server178 If the version cannot be parsed from the remote server
179 `UnparseableBugTrackerVersion` will be raised. If the remote179 `UnparsableBugTrackerVersion` will be raised. If the remote
180 server cannot be reached `BugTrackerConnectError` will be180 server cannot be reached `BugTrackerConnectError` will be
181 raised.181 raised.
182 """182 """
@@ -194,7 +194,7 @@
194 if bugzilla:194 if bugzilla:
195 self.is_issuezilla = True195 self.is_issuezilla = True
196 else:196 else:
197 raise UnparseableBugTrackerVersion(197 raise UnparsableBugTrackerVersion(
198 'Failed to parse version from xml.cgi for %s: could '198 'Failed to parse version from xml.cgi for %s: could '
199 'not find top-level bugzilla element'199 'not find top-level bugzilla element'
200 % self.baseurl)200 % self.baseurl)
@@ -209,7 +209,7 @@
209 as (2, 15).209 as (2, 15).
210210
211 If the passed version is None, None will be returned.211 If the passed version is None, None will be returned.
212 If the version cannot be parsed `UnparseableBugTrackerVersion`212 If the version cannot be parsed `UnparsableBugTrackerVersion`
213 will be raised.213 will be raised.
214 """214 """
215 if version is None:215 if version is None:
@@ -217,7 +217,7 @@
217217
218 version_numbers = re.findall('[0-9]+', version)218 version_numbers = re.findall('[0-9]+', version)
219 if len(version_numbers) == 0:219 if len(version_numbers) == 0:
220 raise UnparseableBugTrackerVersion(220 raise UnparsableBugTrackerVersion(
221 'Failed to parse version %r for %s' %221 'Failed to parse version %r for %s' %
222 (version, self.baseurl))222 (version, self.baseurl))
223223
@@ -310,12 +310,12 @@
310310
311 :param document: An `xml.dom.Document` built from a bug search result311 :param document: An `xml.dom.Document` built from a bug search result
312 on the bugzilla instance.312 on the bugzilla instance.
313 :raise UnparseableBugData: If `document` does not appear to be a bug313 :raise UnparsableBugData: If `document` does not appear to be a bug
314 search result.314 search result.
315 """315 """
316 root = document.documentElement316 root = document.documentElement
317 if root.tagName == 'html':317 if root.tagName == 'html':
318 raise UnparseableBugData(318 raise UnparsableBugData(
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." % (
320 self.baseurl, root.tagName))320 self.baseurl, root.tagName))
321321
@@ -377,8 +377,9 @@
377 try:377 try:
378 document = self._parseDOMString(buglist_xml)378 document = self._parseDOMString(buglist_xml)
379 except xml.parsers.expat.ExpatError, e:379 except xml.parsers.expat.ExpatError, e:
380 raise UnparseableBugData('Failed to parse XML description for '380 raise UnparsableBugData(
381 '%s bugs %s: %s' % (self.baseurl, bug_ids, e))381 "Failed to parse XML description for %s bugs %s: %s"
382 % (self.baseurl, bug_ids, e))
382 self._checkBugSearchResult(document)383 self._checkBugSearchResult(document)
383384
384 bug_nodes = document.getElementsByTagName(bug_tag)385 bug_nodes = document.getElementsByTagName(bug_tag)
@@ -678,8 +679,8 @@
678 status = self._bugs[actual_bug_id]['status']679 status = self._bugs[actual_bug_id]['status']
679 resolution = self._bugs[actual_bug_id]['resolution']680 resolution = self._bugs[actual_bug_id]['resolution']
680 except KeyError:681 except KeyError:
681 raise UnparseableBugData('No status or resolution defined '682 raise UnparsableBugData(
682 'for bug %i' % (bug_id))683 "No status or resolution defined for bug %i" % (bug_id))
683684
684 if resolution != '':685 if resolution != '':
685 return "%s %s" % (status, resolution)686 return "%s %s" % (status, resolution)
@@ -696,8 +697,8 @@
696 priority = self._bugs[actual_bug_id]['priority']697 priority = self._bugs[actual_bug_id]['priority']
697 severity = self._bugs[actual_bug_id]['severity']698 severity = self._bugs[actual_bug_id]['severity']
698 except KeyError:699 except KeyError:
699 raise UnparseableBugData('No priority or severity defined '700 raise UnparsableBugData(
700 'for bug %i' % (bug_id))701 "No priority or severity defined for bug %i" % bug_id)
701702
702 if severity != '':703 if severity != '':
703 return "%s %s" % (priority, severity)704 return "%s %s" % (priority, severity)
704705
=== modified file 'lib/lp/bugs/externalbugtracker/mantis.py'
--- lib/lp/bugs/externalbugtracker/mantis.py 2010-08-24 10:45:57 +0000
+++ lib/lp/bugs/externalbugtracker/mantis.py 2011-01-19 04:53:42 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Mantis ExternalBugTracker utility."""4"""Mantis ExternalBugTracker utility."""
@@ -28,7 +28,7 @@
28 InvalidBugId,28 InvalidBugId,
29 LookupTree,29 LookupTree,
30 UnknownRemoteStatusError,30 UnknownRemoteStatusError,
31 UnparseableBugData,31 UnparsableBugData,
32 )32 )
33from lp.bugs.externalbugtracker.isolation import ensure_no_transaction33from lp.bugs.externalbugtracker.isolation import ensure_no_transaction
34from lp.bugs.interfaces.bugtask import (34from lp.bugs.interfaces.bugtask import (
@@ -272,7 +272,7 @@
272 csv_data = self.csv_data.strip().split("\r\n0")272 csv_data = self.csv_data.strip().split("\r\n0")
273273
274 if not csv_data:274 if not csv_data:
275 raise UnparseableBugData("Empty CSV for %s" % self.baseurl)275 raise UnparsableBugData("Empty CSV for %s" % self.baseurl)
276276
277 # Clean out stray, unquoted newlines inside csv_data to avoid277 # Clean out stray, unquoted newlines inside csv_data to avoid
278 # the CSV module blowing up.278 # the CSV module blowing up.
@@ -284,11 +284,11 @@
284 # ordering and even different columns in the export.284 # ordering and even different columns in the export.
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(",")]
286 if len(self.headers) < 2:286 if len(self.headers) < 2:
287 raise UnparseableBugData("CSV header mangled: %r" % self.headers)287 raise UnparsableBugData("CSV header mangled: %r" % self.headers)
288288
289 if not csv_data:289 if not csv_data:
290 # A file with a header and no bugs is also useless.290 # A file with a header and no bugs is also useless.
291 raise UnparseableBugData("CSV for %s contained no bugs!"291 raise UnparsableBugData("CSV for %s contained no bugs!"
292 % self.baseurl)292 % self.baseurl)
293293
294 try:294 try:
@@ -304,8 +304,7 @@
304 return bugs304 return bugs
305305
306 except csv.Error, error:306 except csv.Error, error:
307 raise UnparseableBugData(307 raise UnparsableBugData("Exception parsing CSV file: %s." % error)
308 "Exception parsing CSV file: %s." % error)
309308
310 def _processCSVBugLine(self, bug_line):309 def _processCSVBugLine(self, bug_line):
311 """Processes a single line of the CSV.310 """Processes a single line of the CSV.
@@ -377,18 +376,16 @@
377 text=lambda node: (node.strip() == key376 text=lambda node: (node.strip() == key
378 and not isinstance(node, Comment)))377 and not isinstance(node, Comment)))
379 if key_node is None:378 if key_node is None:
380 raise UnparseableBugData(379 raise UnparsableBugData("Key %r not found." % (key,))
381 "Key %r not found." % (key,))
382380
383 value_cell = key_node.findNext('td')381 value_cell = key_node.findNext('td')
384 if value_cell is None:382 if value_cell is None:
385 raise UnparseableBugData(383 raise UnparsableBugData(
386 "Value cell for key %r not found." % (key,))384 "Value cell for key %r not found." % (key,))
387385
388 value_node = value_cell.string386 value_node = value_cell.string
389 if value_node is None:387 if value_node is None:
390 raise UnparseableBugData(388 raise UnparsableBugData("Value for key %r not found." % (key,))
391 "Value for key %r not found." % (key,))
392389
393 return value_node.strip()390 return value_node.strip()
394391
@@ -412,39 +409,35 @@
412 text=lambda node: (node.strip() == key409 text=lambda node: (node.strip() == key
413 and not isinstance(node, Comment)))410 and not isinstance(node, Comment)))
414 if key_node is None:411 if key_node is None:
415 raise UnparseableBugData(412 raise UnparsableBugData("Key %r not found." % (key,))
416 "Key %r not found." % (key,))
417413
418 key_cell = key_node.parent414 key_cell = key_node.parent
419 if key_cell is None:415 if key_cell is None:
420 raise UnparseableBugData(416 raise UnparsableBugData("Cell for key %r not found." % (key,))
421 "Cell for key %r not found." % (key,))
422417
423 key_row = key_cell.parent418 key_row = key_cell.parent
424 if key_row is None:419 if key_row is None:
425 raise UnparseableBugData(420 raise UnparsableBugData("Row for key %r not found." % (key,))
426 "Row for key %r not found." % (key,))
427421
428 try:422 try:
429 key_pos = key_row.findAll('td').index(key_cell)423 key_pos = key_row.findAll('td').index(key_cell)
430 except ValueError:424 except ValueError:
431 raise UnparseableBugData(425 raise UnparsableBugData(
432 "Key cell in row for key %r not found." % (key,))426 "Key cell in row for key %r not found." % (key,))
433427
434 value_row = key_row.findNextSibling('tr')428 value_row = key_row.findNextSibling('tr')
435 if value_row is None:429 if value_row is None:
436 raise UnparseableBugData(430 raise UnparsableBugData(
437 "Value row for key %r not found." % (key,))431 "Value row for key %r not found." % (key,))
438432
439 value_cell = value_row.findAll('td')[key_pos]433 value_cell = value_row.findAll('td')[key_pos]
440 if value_cell is None:434 if value_cell is None:
441 raise UnparseableBugData(435 raise UnparsableBugData(
442 "Value cell for key %r not found." % (key,))436 "Value cell for key %r not found." % (key,))
443437
444 value_node = value_cell.string438 value_node = value_cell.string
445 if value_node is None:439 if value_node is None:
446 raise UnparseableBugData(440 raise UnparsableBugData("Value for key %r not found." % (key,))
447 "Value for key %r not found." % (key,))
448441
449 return value_node.strip()442 return value_node.strip()
450443
451444
=== modified file 'lib/lp/bugs/externalbugtracker/roundup.py'
--- lib/lp/bugs/externalbugtracker/roundup.py 2010-08-20 20:31:18 +0000
+++ lib/lp/bugs/externalbugtracker/roundup.py 2011-01-19 04:53:42 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Round ExternalBugTracker utility."""4"""Round ExternalBugTracker utility."""
@@ -17,7 +17,7 @@
17 InvalidBugId,17 InvalidBugId,
18 LookupTree,18 LookupTree,
19 UnknownRemoteStatusError,19 UnknownRemoteStatusError,
20 UnparseableBugData,20 UnparsableBugData,
21 )21 )
22from lp.bugs.interfaces.bugtask import (22from lp.bugs.interfaces.bugtask import (
23 BugTaskImportance,23 BugTaskImportance,
@@ -263,7 +263,7 @@
263 if field in remote_bug:263 if field in remote_bug:
264 field_values.append(remote_bug[field])264 field_values.append(remote_bug[field])
265 else:265 else:
266 raise UnparseableBugData(266 raise UnparsableBugData(
267 "Remote bug %s does not define a value for %s." % (267 "Remote bug %s does not define a value for %s." % (
268 bug_id, field))268 bug_id, field))
269269
270270
=== modified file 'lib/lp/bugs/externalbugtracker/sourceforge.py'
--- lib/lp/bugs/externalbugtracker/sourceforge.py 2010-08-20 20:31:18 +0000
+++ lib/lp/bugs/externalbugtracker/sourceforge.py 2011-01-19 04:53:42 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Sourceforge ExternalBugTracker utility."""4"""Sourceforge ExternalBugTracker utility."""
@@ -19,7 +19,7 @@
19 LookupTree,19 LookupTree,
20 PrivateRemoteBug,20 PrivateRemoteBug,
21 UnknownRemoteStatusError,21 UnknownRemoteStatusError,
22 UnparseableBugData,22 UnparsableBugData,
23 )23 )
24from lp.bugs.interfaces.bugtask import (24from lp.bugs.interfaces.bugtask import (
25 BugTaskImportance,25 BugTaskImportance,
@@ -77,7 +77,7 @@
77 else:77 else:
78 # If we can't find a status line in the output from78 # If we can't find a status line in the output from
79 # SourceForge there's little point in continuing.79 # SourceForge there's little point in continuing.
80 raise UnparseableBugData(80 raise UnparsableBugData(
81 'Remote bug %s does not define a status.' % bug_id)81 'Remote bug %s does not define a status.' % bug_id)
8282
83 # We need to do the same for Resolution, though if we can't83 # We need to do the same for Resolution, though if we can't
@@ -176,7 +176,7 @@
176 try:176 try:
177 return '%(status)s:%(resolution)s' % remote_bug177 return '%(status)s:%(resolution)s' % remote_bug
178 except KeyError:178 except KeyError:
179 raise UnparseableBugData(179 raise UnparsableBugData(
180 "Remote bug %i does not define a status." % bug_id)180 "Remote bug %i does not define a status." % bug_id)
181181
182 def convertRemoteImportance(self, remote_importance):182 def convertRemoteImportance(self, remote_importance):
@@ -266,4 +266,3 @@
266 return None266 return None
267 else:267 else:
268 return "%s&%s" % (group_id, atid)268 return "%s&%s" % (group_id, atid)
269
270269
=== modified file 'lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py'
--- lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py 2011-01-18 20:46:11 +0000
+++ lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py 2011-01-19 04:53:42 +0000
@@ -1,4 +1,4 @@
1# Copyright 2010 Canonical Ltd. This software is licensed under the1# Copyright 2010-2011 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Tests for the Bugzilla BugTracker."""4"""Tests for the Bugzilla BugTracker."""
@@ -8,7 +8,7 @@
8from StringIO import StringIO8from StringIO import StringIO
99
10from canonical.testing.layers import DatabaseFunctionalLayer10from canonical.testing.layers import DatabaseFunctionalLayer
11from lp.bugs.externalbugtracker.base import UnparseableBugData11from lp.bugs.externalbugtracker.base import UnparsableBugData
12from lp.bugs.externalbugtracker.bugzilla import Bugzilla12from lp.bugs.externalbugtracker.bugzilla import Bugzilla
13from lp.testing import TestCaseWithFactory13from lp.testing import TestCaseWithFactory
14from lp.testing.fakemethod import FakeMethod14from lp.testing.fakemethod import FakeMethod
@@ -54,4 +54,4 @@
54 </html>54 </html>
55 """55 """
56 bugzilla = self._makeInstrumentedBugzilla(content=result_text)56 bugzilla = self._makeInstrumentedBugzilla(content=result_text)
57 self.assertRaises(UnparseableBugData, bugzilla.getRemoteBugBatch, [])57 self.assertRaises(UnparsableBugData, bugzilla.getRemoteBugBatch, [])
5858
=== modified file 'lib/lp/bugs/externalbugtracker/trac.py'
--- lib/lp/bugs/externalbugtracker/trac.py 2010-11-10 09:28:09 +0000
+++ lib/lp/bugs/externalbugtracker/trac.py 2011-01-19 04:53:42 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Trac ExternalBugTracker implementation."""4"""Trac ExternalBugTracker implementation."""
@@ -30,7 +30,7 @@
30 InvalidBugId,30 InvalidBugId,
31 LookupTree,31 LookupTree,
32 UnknownRemoteStatusError,32 UnknownRemoteStatusError,
33 UnparseableBugData,33 UnparsableBugData,
34 )34 )
35from lp.bugs.externalbugtracker.isolation import ensure_no_transaction35from lp.bugs.externalbugtracker.isolation import ensure_no_transaction
36from lp.bugs.externalbugtracker.xmlrpc import UrlLib2Transport36from lp.bugs.externalbugtracker.xmlrpc import UrlLib2Transport
@@ -143,13 +143,13 @@
143 # We consider the data we're getting from the remote server to143 # We consider the data we're getting from the remote server to
144 # be valid if there is an ID field and a status field in the CSV144 # be valid if there is an ID field and a status field in the CSV
145 # header. If the fields don't exist we raise an145 # header. If the fields don't exist we raise an
146 # UnparseableBugData error. If these fields are defined but not146 # UnparsableBugData error. If these fields are defined but not
147 # filled in for each row, that error will be handled in147 # filled in for each row, that error will be handled in
148 # getRemoteBugStatus() (i.e. with a BugNotFound or an148 # getRemoteBugStatus() (i.e. with a BugNotFound or an
149 # UnknownRemoteStatusError).149 # UnknownRemoteStatusError).
150 if ('id' not in csv_reader.fieldnames or150 if ('id' not in csv_reader.fieldnames or
151 'status' not in csv_reader.fieldnames):151 'status' not in csv_reader.fieldnames):
152 raise UnparseableBugData(152 raise UnparsableBugData(
153 "External bugtracker %s does not define all the necessary "153 "External bugtracker %s does not define all the necessary "
154 "fields for bug status imports (Defined field names: %r)."154 "fields for bug status imports (Defined field names: %r)."
155 % (self.baseurl, csv_reader.fieldnames))155 % (self.baseurl, csv_reader.fieldnames))
@@ -169,7 +169,7 @@
169 # There should be only one bug returned for a getRemoteBug()169 # There should be only one bug returned for a getRemoteBug()
170 # call, so if we have more or less than one bug something went170 # call, so if we have more or less than one bug something went
171 # wrong.171 # wrong.
172 raise UnparseableBugData(172 raise UnparsableBugData(
173 "Remote bugtracker %s returned wrong amount of data for bug "173 "Remote bugtracker %s returned wrong amount of data for bug "
174 "%i (expected 1 bug, got %i bugs)." %174 "%i (expected 1 bug, got %i bugs)." %
175 (self.baseurl, bug_id, len(bug_data)))175 (self.baseurl, bug_id, len(bug_data)))
@@ -248,7 +248,7 @@
248248
249 # If the bug has a valid resolution as well as a status then we return249 # If the bug has a valid resolution as well as a status then we return
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.
251 if (remote_bug.has_key('resolution') and251 if ('resolution' in remote_bug and
252 remote_bug['resolution'] not in ['', '--', None]):252 remote_bug['resolution'] not in ['', '--', None]):
253 return remote_bug['resolution']253 return remote_bug['resolution']
254 else:254 else:
@@ -295,6 +295,7 @@
295 If an `xmlrpclib.ProtocolError` with error code 403 is raised by the295 If an `xmlrpclib.ProtocolError` with error code 403 is raised by the
296 function, we'll try to authenticate and call the function again.296 function, we'll try to authenticate and call the function again.
297 """297 """
298
298 def decorator(self, *args, **kwargs):299 def decorator(self, *args, **kwargs):
299 try:300 try:
300 return func(self, *args, **kwargs)301 return func(self, *args, **kwargs)
@@ -401,7 +402,8 @@
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.
402 criteria = {403 criteria = {
403 'modified_since': last_checked_timestamp,404 'modified_since': last_checked_timestamp,
404 'bugs': remote_bug_ids,}405 'bugs': remote_bug_ids,
406 }
405 time_snapshot, modified_bugs = self._server.launchpad.bug_info(407 time_snapshot, modified_bugs = self._server.launchpad.bug_info(
406 LP_PLUGIN_BUG_IDS_ONLY, criteria)408 LP_PLUGIN_BUG_IDS_ONLY, criteria)
407409
408410
=== modified file 'lib/lp/bugs/scripts/checkwatches/utilities.py'
--- lib/lp/bugs/scripts/checkwatches/utilities.py 2010-08-20 20:31:18 +0000
+++ lib/lp/bugs/scripts/checkwatches/utilities.py 2011-01-19 04:53:42 +0000
@@ -1,4 +1,4 @@
1# Copyright 2010 Canonical Ltd. This software is licensed under the1# Copyright 2010-2011 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Utility functions for checkwatches."""4"""Utility functions for checkwatches."""
@@ -17,8 +17,8 @@
17 InvalidBugId,17 InvalidBugId,
18 PrivateRemoteBug,18 PrivateRemoteBug,
19 UnknownBugTrackerTypeError,19 UnknownBugTrackerTypeError,
20 UnparseableBugData,20 UnparsableBugData,
21 UnparseableBugTrackerVersion,21 UnparsableBugTrackerVersion,
22 UnsupportedBugTrackerVersion,22 UnsupportedBugTrackerVersion,
23 )23 )
24from lp.bugs.interfaces.bugwatch import BugWatchActivityStatus24from lp.bugs.interfaces.bugwatch import BugWatchActivityStatus
@@ -27,8 +27,8 @@
27_exception_to_bugwatcherrortype = [27_exception_to_bugwatcherrortype = [
28 (BugTrackerConnectError, BugWatchActivityStatus.CONNECTION_ERROR),28 (BugTrackerConnectError, BugWatchActivityStatus.CONNECTION_ERROR),
29 (PrivateRemoteBug, BugWatchActivityStatus.PRIVATE_REMOTE_BUG),29 (PrivateRemoteBug, BugWatchActivityStatus.PRIVATE_REMOTE_BUG),
30 (UnparseableBugData, BugWatchActivityStatus.UNPARSABLE_BUG),30 (UnparsableBugData, BugWatchActivityStatus.UNPARSABLE_BUG),
31 (UnparseableBugTrackerVersion,31 (UnparsableBugTrackerVersion,
32 BugWatchActivityStatus.UNPARSABLE_BUG_TRACKER),32 BugWatchActivityStatus.UNPARSABLE_BUG_TRACKER),
33 (UnsupportedBugTrackerVersion,33 (UnsupportedBugTrackerVersion,
34 BugWatchActivityStatus.UNSUPPORTED_BUG_TRACKER),34 BugWatchActivityStatus.UNSUPPORTED_BUG_TRACKER),
@@ -62,5 +62,5 @@
62 ('batch_query_threshold', remote_system.batch_query_threshold),62 ('batch_query_threshold', remote_system.batch_query_threshold),
63 ('sync_comments', remote_system.sync_comments),63 ('sync_comments', remote_system.sync_comments),
64 ('externalbugtracker', remote_system.__class__.__name__),64 ('externalbugtracker', remote_system.__class__.__name__),
65 ('baseurl', remote_system.baseurl)65 ('baseurl', remote_system.baseurl),
66 ]66 ]
6767
=== modified file 'lib/lp/code/errors.py'
--- lib/lp/code/errors.py 2010-11-12 23:30:57 +0000
+++ lib/lp/code/errors.py 2011-01-19 04:53:42 +0000
@@ -182,7 +182,7 @@
182class InvalidNamespace(Exception):182class InvalidNamespace(Exception):
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.
184184
185 By 'bad', we mean that the name is unparseable. It might be too short, too185 By 'bad', we mean that the name is unparsable. It might be too short, too
186 long or malformed in some other way.186 long or malformed in some other way.
187 """187 """
188188