=== 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 @@ BugNotFound: no-such-bug If the data we've imported from Bugzilla is incomplete and doesn't -contain either the bug's status or its resolution an UnparseableBugData +contain either the bug's status or its resolution an UnparsableBugData error will be raised. We can add a sample bug to demonstrate this. >>> bugzilla._bugs[999] = {} >>> bugzilla.getRemoteStatus(999) Traceback (most recent call last): ... - UnparseableBugData: No status or resolution defined for bug 999 + UnparsableBugData: No status or resolution defined for bug 999 >>> del bugzilla._bugs[999] @@ -338,7 +338,7 @@ ... print " %s: %s" % (key, bugzilla._bugs[bug][key]) ... print "\n" Bug 1: - alias: + alias: assigned_to: test@canonical.com... Bug 2: alias: bug-two @@ -387,7 +387,8 @@ instance. >>> from canonical.launchpad.webapp.testing import verifyObject - >>> from lp.bugs.interfaces.externalbugtracker import ISupportsCommentImport + >>> from lp.bugs.interfaces.externalbugtracker import ( + ... ISupportsCommentImport) >>> verifyObject(ISupportsCommentImport, bugzilla) True === 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 @@ >>> for bug_watch in mozilla_bugzilla.watches: ... print "%s: %s %s" % (bug_watch.remotebug, ... bug_watch.remotestatus, bug_watch.remote_importance) - 2000: - 123543: + 2000: + 123543: 42: FUBAR BAZBAZ 42: FUBAR BAZBAZ >>> transaction.commit() @@ -136,5 +136,5 @@ >>> broken_bugzilla.initializeRemoteBugDB(remote_bugs) Traceback (most recent call last): ... - UnparseableBugData: Failed to parse XML description... + UnparsableBugData: Failed to parse XML description... === 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 @@ The Bugzilla ExternalBugTracker works differently depending on which version of Bugzilla it is talking to. If it's a version we can't parse, -UnparseableBugTrackerVersion is raised: +UnparsableBugTrackerVersion is raised: >>> from canonical.testing.layers import LaunchpadZopelessLayer >>> txn = LaunchpadZopelessLayer.txn >>> external_bugzilla = Bugzilla('http://example.com/', version='A.B') Traceback (most recent call last): ... - UnparseableBugTrackerVersion: + UnparsableBugTrackerVersion: Failed to parse version 'A.B' for http://... The version parsing is carried out by the Bugzilla._parseVersion() @@ -669,7 +669,7 @@ ... external_bugzilla, [bug_watch1, bug_watch2]) Traceback (most recent call last): ... - UnparseableBugData: + UnparsableBugData: Failed to parse XML description for https://bugzilla.mozilla.org... The error is also recorded in each bug watch's last_error_type field so that === 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 @@ >>> sourceforge.initializeRemoteBugDB([0]) Traceback (most recent call last): ... - UnparseableBugData: Remote bug 0 does not define a status. + UnparsableBugData: Remote bug 0 does not define a status. Some SourceForge bugs are marked private. Although we can't import a status from them, we don't raise an error when trying to initialize the @@ -141,7 +141,8 @@ Launchpad.dev bug #10 is the same bug as reported in example.com bug #1722250, so we add a watch against the remote bug. - >>> from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities + >>> from canonical.launchpad.interfaces.launchpad import ( + ... ILaunchpadCelebrities) >>> from lp.registry.interfaces.person import IPersonSet >>> from lp.bugs.tests.externalbugtracker import ( ... new_bugtracker) === 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 @@ remote bug IDs will fetch those bug IDs from the server and file them in a local variable for later use. -We use a test-oriented implementation for the purposes of these tests, which +We use a test-oriented implementation for the purposes of these tests, which overrides ExternalBugTracker.urlopen() so that we don't have to rely on a working network connection. @@ -208,7 +208,7 @@ CALLED urlopen(u'http://test.trac/query?id=6&id=7...&format=csv') If, when using the batch export method, the Trac instance comes across -invalid data, it will raise an UnparseableBugData exception. We will +invalid data, it will raise an UnparsableBugData exception. We will force our trac instance to use invalid data for the purposes of this test. @@ -216,7 +216,7 @@ >>> trac.initializeRemoteBugDB([6, 7, 8, 9, 10]) Traceback (most recent call last): ... - UnparseableBugData: External bugtracker http://test.trac does not + UnparsableBugData: External bugtracker http://test.trac does not define all the necessary fields for bug status imports (Defined field names: ['']). @@ -226,7 +226,7 @@ >>> trac.initializeRemoteBugDB([6]) Traceback (most recent call last): ... - UnparseableBugData: External bugtracker http://test.trac does not + UnparsableBugData: External bugtracker http://test.trac does not define all the necessary fields for bug status imports (Defined field names: ['']). @@ -261,13 +261,13 @@ [1, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153] If _fetchBugData() receives a response that isn't a valid Trac CSV -export, it will raise an UnparseableBugData error. +export, it will raise an UnparsableBugData error. >>> trac.csv_export_file = 'trac_example_broken_ticket_export.csv' >>> trac._fetchBugData(query_url) Traceback (most recent call last): ... - UnparseableBugData: External bugtracker http://test.trac does not + UnparsableBugData: External bugtracker http://test.trac does not define all the necessary fields for bug status imports (Defined field names: ['']). @@ -279,11 +279,13 @@ >>> from lp.bugs.interfaces.bug import IBugSet >>> from lp.registry.interfaces.person import IPersonSet - >>> sample_person = getUtility(IPersonSet).getByEmail('test@canonical.com') + >>> sample_person = getUtility(IPersonSet).getByEmail( + ... 'test@canonical.com') >>> example_bug_tracker = new_bugtracker(BugTrackerType.TRAC) - >>> from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities + >>> from canonical.launchpad.interfaces.launchpad import ( + ... ILaunchpadCelebrities) >>> example_bug = getUtility(IBugSet).get(10) >>> example_bugwatch = example_bug.addWatch( ... example_bug_tracker, '1', === 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 @@ >>> from lp.bugs.externalbugtracker import ( ... BugNotFound, BugTrackerConnectError, InvalidBugId, - ... UnparseableBugData, UnparseableBugTrackerVersion) + ... UnparsableBugData, UnparsableBugTrackerVersion) TestBrokenExternalBugTracker allows us to force errors to occur, so we can use it to check that bug watches' last_error_types are being set @@ -746,8 +746,8 @@ checkwatches ran instead of just once every 24 hours like any other bug watch. - >>> for error in [BugTrackerConnectError, UnparseableBugData, - ... UnparseableBugTrackerVersion, Exception]: + >>> for error in [BugTrackerConnectError, UnparsableBugData, + ... UnparsableBugTrackerVersion, Exception]: ... example_bugwatch.lastchecked = None ... external_bugtracker.initialize_remote_bugdb_error = error ... try: @@ -776,7 +776,7 @@ >>> error_utility = CheckWatchesErrorUtility() >>> external_bugtracker.initialize_remote_bugdb_error = None - >>> for error in [BugNotFound, InvalidBugId, UnparseableBugData, + >>> for error in [BugNotFound, InvalidBugId, UnparsableBugData, ... Exception]: ... example_bugwatch.lastchecked = None ... external_bugtracker.get_remote_status_error = error === 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 @@ -# Copyright 2009 Canonical Ltd. This software is licensed under the +# Copyright 2009-2011 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). # pylint: disable-msg=W0401 @@ -27,8 +27,8 @@ 'Trac', 'UnknownBugTrackerTypeError', 'UnknownRemoteStatusError', - 'UnparseableBugData', - 'UnparseableBugTrackerVersion', + 'UnparsableBugData', + 'UnparsableBugTrackerVersion', 'UnsupportedBugTrackerVersion', 'get_external_bugtracker', ] @@ -51,7 +51,7 @@ BugTrackerType.TRAC: Trac, BugTrackerType.ROUNDUP: Roundup, BugTrackerType.RT: RequestTracker, - BugTrackerType.SOURCEFORGE: SourceForge + BugTrackerType.SOURCEFORGE: SourceForge, } === 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 @@ -# Copyright 2009 Canonical Ltd. This software is licensed under the +# Copyright 2009-2011 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). """External bugtrackers.""" @@ -18,8 +18,8 @@ 'UnknownBugTrackerTypeError', 'UnknownRemoteImportanceError', 'UnknownRemoteStatusError', - 'UnparseableBugData', - 'UnparseableBugTrackerVersion', + 'UnparsableBugData', + 'UnparsableBugTrackerVersion', 'UnsupportedBugTrackerVersion', ] @@ -71,11 +71,11 @@ """The bug tracker version is not supported.""" -class UnparseableBugTrackerVersion(BugWatchUpdateError): +class UnparsableBugTrackerVersion(BugWatchUpdateError): """The bug tracker version could not be parsed.""" -class UnparseableBugData(BugWatchUpdateError): +class UnparsableBugData(BugWatchUpdateError): """The bug tracker provided bug data that could not be parsed.""" @@ -215,7 +215,7 @@ Raise BugNotFound if the bug can't be found. Raise InvalidBugId if the bug id has an unexpected format. - Raise UnparseableBugData if the bug data cannot be parsed. + Raise UnparsableBugData if the bug data cannot be parsed. """ # This method should be overridden by subclasses, so we raise a # NotImplementedError if this version of it gets called for some === 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 @@ -# Copyright 2009 Canonical Ltd. This software is licensed under the +# Copyright 2009-2011 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). """Bugzilla ExternalBugTracker utility.""" @@ -37,8 +37,8 @@ LookupTree, UnknownRemoteImportanceError, UnknownRemoteStatusError, - UnparseableBugData, - UnparseableBugTrackerVersion, + UnparsableBugData, + UnparsableBugTrackerVersion, ) from lp.bugs.externalbugtracker.isolation import ensure_no_transaction from lp.bugs.externalbugtracker.xmlrpc import UrlLib2Transport @@ -176,7 +176,7 @@ """Retrieve and return a remote bugzilla version. If the version cannot be parsed from the remote server - `UnparseableBugTrackerVersion` will be raised. If the remote + `UnparsableBugTrackerVersion` will be raised. If the remote server cannot be reached `BugTrackerConnectError` will be raised. """ @@ -194,7 +194,7 @@ if bugzilla: self.is_issuezilla = True else: - raise UnparseableBugTrackerVersion( + raise UnparsableBugTrackerVersion( 'Failed to parse version from xml.cgi for %s: could ' 'not find top-level bugzilla element' % self.baseurl) @@ -209,7 +209,7 @@ as (2, 15). If the passed version is None, None will be returned. - If the version cannot be parsed `UnparseableBugTrackerVersion` + If the version cannot be parsed `UnparsableBugTrackerVersion` will be raised. """ if version is None: @@ -217,7 +217,7 @@ version_numbers = re.findall('[0-9]+', version) if len(version_numbers) == 0: - raise UnparseableBugTrackerVersion( + raise UnparsableBugTrackerVersion( 'Failed to parse version %r for %s' % (version, self.baseurl)) @@ -310,12 +310,12 @@ :param document: An `xml.dom.Document` built from a bug search result on the bugzilla instance. - :raise UnparseableBugData: If `document` does not appear to be a bug + :raise UnparsableBugData: If `document` does not appear to be a bug search result. """ root = document.documentElement if root.tagName == 'html': - raise UnparseableBugData( + raise UnparsableBugData( "Bug search on %s returned a <%s> instead of an RDF page." % ( self.baseurl, root.tagName)) @@ -377,8 +377,9 @@ try: document = self._parseDOMString(buglist_xml) except xml.parsers.expat.ExpatError, e: - raise UnparseableBugData('Failed to parse XML description for ' - '%s bugs %s: %s' % (self.baseurl, bug_ids, e)) + raise UnparsableBugData( + "Failed to parse XML description for %s bugs %s: %s" + % (self.baseurl, bug_ids, e)) self._checkBugSearchResult(document) bug_nodes = document.getElementsByTagName(bug_tag) @@ -678,8 +679,8 @@ status = self._bugs[actual_bug_id]['status'] resolution = self._bugs[actual_bug_id]['resolution'] except KeyError: - raise UnparseableBugData('No status or resolution defined ' - 'for bug %i' % (bug_id)) + raise UnparsableBugData( + "No status or resolution defined for bug %i" % (bug_id)) if resolution != '': return "%s %s" % (status, resolution) @@ -696,8 +697,8 @@ priority = self._bugs[actual_bug_id]['priority'] severity = self._bugs[actual_bug_id]['severity'] except KeyError: - raise UnparseableBugData('No priority or severity defined ' - 'for bug %i' % (bug_id)) + raise UnparsableBugData( + "No priority or severity defined for bug %i" % bug_id) if severity != '': return "%s %s" % (priority, severity) === 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 @@ -# Copyright 2009 Canonical Ltd. This software is licensed under the +# Copyright 2009-2011 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). """Mantis ExternalBugTracker utility.""" @@ -28,7 +28,7 @@ InvalidBugId, LookupTree, UnknownRemoteStatusError, - UnparseableBugData, + UnparsableBugData, ) from lp.bugs.externalbugtracker.isolation import ensure_no_transaction from lp.bugs.interfaces.bugtask import ( @@ -272,7 +272,7 @@ csv_data = self.csv_data.strip().split("\r\n0") if not csv_data: - raise UnparseableBugData("Empty CSV for %s" % self.baseurl) + raise UnparsableBugData("Empty CSV for %s" % self.baseurl) # Clean out stray, unquoted newlines inside csv_data to avoid # the CSV module blowing up. @@ -284,11 +284,11 @@ # ordering and even different columns in the export. self.headers = [h.lower() for h in csv_data.pop(0).split(",")] if len(self.headers) < 2: - raise UnparseableBugData("CSV header mangled: %r" % self.headers) + raise UnparsableBugData("CSV header mangled: %r" % self.headers) if not csv_data: # A file with a header and no bugs is also useless. - raise UnparseableBugData("CSV for %s contained no bugs!" + raise UnparsableBugData("CSV for %s contained no bugs!" % self.baseurl) try: @@ -304,8 +304,7 @@ return bugs except csv.Error, error: - raise UnparseableBugData( - "Exception parsing CSV file: %s." % error) + raise UnparsableBugData("Exception parsing CSV file: %s." % error) def _processCSVBugLine(self, bug_line): """Processes a single line of the CSV. @@ -377,18 +376,16 @@ text=lambda node: (node.strip() == key and not isinstance(node, Comment))) if key_node is None: - raise UnparseableBugData( - "Key %r not found." % (key,)) + raise UnparsableBugData("Key %r not found." % (key,)) value_cell = key_node.findNext('td') if value_cell is None: - raise UnparseableBugData( + raise UnparsableBugData( "Value cell for key %r not found." % (key,)) value_node = value_cell.string if value_node is None: - raise UnparseableBugData( - "Value for key %r not found." % (key,)) + raise UnparsableBugData("Value for key %r not found." % (key,)) return value_node.strip() @@ -412,39 +409,35 @@ text=lambda node: (node.strip() == key and not isinstance(node, Comment))) if key_node is None: - raise UnparseableBugData( - "Key %r not found." % (key,)) + raise UnparsableBugData("Key %r not found." % (key,)) key_cell = key_node.parent if key_cell is None: - raise UnparseableBugData( - "Cell for key %r not found." % (key,)) + raise UnparsableBugData("Cell for key %r not found." % (key,)) key_row = key_cell.parent if key_row is None: - raise UnparseableBugData( - "Row for key %r not found." % (key,)) + raise UnparsableBugData("Row for key %r not found." % (key,)) try: key_pos = key_row.findAll('td').index(key_cell) except ValueError: - raise UnparseableBugData( + raise UnparsableBugData( "Key cell in row for key %r not found." % (key,)) value_row = key_row.findNextSibling('tr') if value_row is None: - raise UnparseableBugData( + raise UnparsableBugData( "Value row for key %r not found." % (key,)) value_cell = value_row.findAll('td')[key_pos] if value_cell is None: - raise UnparseableBugData( + raise UnparsableBugData( "Value cell for key %r not found." % (key,)) value_node = value_cell.string if value_node is None: - raise UnparseableBugData( - "Value for key %r not found." % (key,)) + raise UnparsableBugData("Value for key %r not found." % (key,)) return value_node.strip() === 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 @@ -# Copyright 2009 Canonical Ltd. This software is licensed under the +# Copyright 2009-2011 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). """Round ExternalBugTracker utility.""" @@ -17,7 +17,7 @@ InvalidBugId, LookupTree, UnknownRemoteStatusError, - UnparseableBugData, + UnparsableBugData, ) from lp.bugs.interfaces.bugtask import ( BugTaskImportance, @@ -263,7 +263,7 @@ if field in remote_bug: field_values.append(remote_bug[field]) else: - raise UnparseableBugData( + raise UnparsableBugData( "Remote bug %s does not define a value for %s." % ( bug_id, field)) === 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 @@ -# Copyright 2009 Canonical Ltd. This software is licensed under the +# Copyright 2009-2011 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). """Sourceforge ExternalBugTracker utility.""" @@ -19,7 +19,7 @@ LookupTree, PrivateRemoteBug, UnknownRemoteStatusError, - UnparseableBugData, + UnparsableBugData, ) from lp.bugs.interfaces.bugtask import ( BugTaskImportance, @@ -77,7 +77,7 @@ else: # If we can't find a status line in the output from # SourceForge there's little point in continuing. - raise UnparseableBugData( + raise UnparsableBugData( 'Remote bug %s does not define a status.' % bug_id) # We need to do the same for Resolution, though if we can't @@ -176,7 +176,7 @@ try: return '%(status)s:%(resolution)s' % remote_bug except KeyError: - raise UnparseableBugData( + raise UnparsableBugData( "Remote bug %i does not define a status." % bug_id) def convertRemoteImportance(self, remote_importance): @@ -266,4 +266,3 @@ return None else: return "%s&%s" % (group_id, atid) - === 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 @@ -# Copyright 2010 Canonical Ltd. This software is licensed under the +# Copyright 2010-2011 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). """Tests for the Bugzilla BugTracker.""" @@ -8,7 +8,7 @@ from StringIO import StringIO from canonical.testing.layers import DatabaseFunctionalLayer -from lp.bugs.externalbugtracker.base import UnparseableBugData +from lp.bugs.externalbugtracker.base import UnparsableBugData from lp.bugs.externalbugtracker.bugzilla import Bugzilla from lp.testing import TestCaseWithFactory from lp.testing.fakemethod import FakeMethod @@ -54,4 +54,4 @@ """ bugzilla = self._makeInstrumentedBugzilla(content=result_text) - self.assertRaises(UnparseableBugData, bugzilla.getRemoteBugBatch, []) + self.assertRaises(UnparsableBugData, bugzilla.getRemoteBugBatch, []) === 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 @@ -# Copyright 2009 Canonical Ltd. This software is licensed under the +# Copyright 2009-2011 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). """Trac ExternalBugTracker implementation.""" @@ -30,7 +30,7 @@ InvalidBugId, LookupTree, UnknownRemoteStatusError, - UnparseableBugData, + UnparsableBugData, ) from lp.bugs.externalbugtracker.isolation import ensure_no_transaction from lp.bugs.externalbugtracker.xmlrpc import UrlLib2Transport @@ -143,13 +143,13 @@ # We consider the data we're getting from the remote server to # be valid if there is an ID field and a status field in the CSV # header. If the fields don't exist we raise an - # UnparseableBugData error. If these fields are defined but not + # UnparsableBugData error. If these fields are defined but not # filled in for each row, that error will be handled in # getRemoteBugStatus() (i.e. with a BugNotFound or an # UnknownRemoteStatusError). if ('id' not in csv_reader.fieldnames or 'status' not in csv_reader.fieldnames): - raise UnparseableBugData( + raise UnparsableBugData( "External bugtracker %s does not define all the necessary " "fields for bug status imports (Defined field names: %r)." % (self.baseurl, csv_reader.fieldnames)) @@ -169,7 +169,7 @@ # There should be only one bug returned for a getRemoteBug() # call, so if we have more or less than one bug something went # wrong. - raise UnparseableBugData( + raise UnparsableBugData( "Remote bugtracker %s returned wrong amount of data for bug " "%i (expected 1 bug, got %i bugs)." % (self.baseurl, bug_id, len(bug_data))) @@ -248,7 +248,7 @@ # If the bug has a valid resolution as well as a status then we return # that, since it's more informative than the status field on its own. - if (remote_bug.has_key('resolution') and + if ('resolution' in remote_bug and remote_bug['resolution'] not in ['', '--', None]): return remote_bug['resolution'] else: @@ -295,6 +295,7 @@ If an `xmlrpclib.ProtocolError` with error code 403 is raised by the function, we'll try to authenticate and call the function again. """ + def decorator(self, *args, **kwargs): try: return func(self, *args, **kwargs) @@ -401,7 +402,8 @@ # We retrieve only the IDs of the modified bugs from the server. criteria = { 'modified_since': last_checked_timestamp, - 'bugs': remote_bug_ids,} + 'bugs': remote_bug_ids, + } time_snapshot, modified_bugs = self._server.launchpad.bug_info( LP_PLUGIN_BUG_IDS_ONLY, criteria) === 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 @@ -# Copyright 2010 Canonical Ltd. This software is licensed under the +# Copyright 2010-2011 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). """Utility functions for checkwatches.""" @@ -17,8 +17,8 @@ InvalidBugId, PrivateRemoteBug, UnknownBugTrackerTypeError, - UnparseableBugData, - UnparseableBugTrackerVersion, + UnparsableBugData, + UnparsableBugTrackerVersion, UnsupportedBugTrackerVersion, ) from lp.bugs.interfaces.bugwatch import BugWatchActivityStatus @@ -27,8 +27,8 @@ _exception_to_bugwatcherrortype = [ (BugTrackerConnectError, BugWatchActivityStatus.CONNECTION_ERROR), (PrivateRemoteBug, BugWatchActivityStatus.PRIVATE_REMOTE_BUG), - (UnparseableBugData, BugWatchActivityStatus.UNPARSABLE_BUG), - (UnparseableBugTrackerVersion, + (UnparsableBugData, BugWatchActivityStatus.UNPARSABLE_BUG), + (UnparsableBugTrackerVersion, BugWatchActivityStatus.UNPARSABLE_BUG_TRACKER), (UnsupportedBugTrackerVersion, BugWatchActivityStatus.UNSUPPORTED_BUG_TRACKER), @@ -62,5 +62,5 @@ ('batch_query_threshold', remote_system.batch_query_threshold), ('sync_comments', remote_system.sync_comments), ('externalbugtracker', remote_system.__class__.__name__), - ('baseurl', remote_system.baseurl) + ('baseurl', remote_system.baseurl), ] === 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 @@ class InvalidNamespace(Exception): """Raised when someone tries to lookup a namespace with a bad name. - By 'bad', we mean that the name is unparseable. It might be too short, too + By 'bad', we mean that the name is unparsable. It might be too short, too long or malformed in some other way. """