← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/bug-716411 into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/bug-716411 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #716411 in Launchpad itself: "URLError trying to connect to bugtracker"
  https://bugs.launchpad.net/launchpad/+bug/716411

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/bug-716411/+merge/53729

Fixes a couple of hundred exceptions a day like OOPS-1901CCW10 and OOPS-1901CCW1. There's no way to handle BugTrackerConnectErrors at this point, so it's best to ignore the exceptions for now. The EBT will later convert connection errors into BugTrackerConnectErrors, raising them in a location that checkwatches can sensibly handle by logging to BugWatchActivity.
-- 
https://code.launchpad.net/~wgrant/launchpad/bug-716411/+merge/53729
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/bug-716411 into lp:launchpad.
=== modified file 'lib/lp/bugs/externalbugtracker/bugzilla.py'
--- lib/lp/bugs/externalbugtracker/bugzilla.py	2011-03-11 03:19:07 +0000
+++ lib/lp/bugs/externalbugtracker/bugzilla.py	2011-03-17 02:37:31 +0000
@@ -13,6 +13,8 @@
 
 from email.Utils import parseaddr
 import re
+from httplib import BadStatusLine
+from urllib2 import URLError
 from xml.dom import minidom
 import xml.parsers.expat
 import xmlrpclib
@@ -156,12 +158,14 @@
 
         See `IExternalBugTracker`.
         """
-        if self._remoteSystemHasPluginAPI():
-            return BugzillaLPPlugin(self.baseurl)
-        elif self._remoteSystemHasBugzillaAPI():
-            return BugzillaAPI(self.baseurl)
-        else:
-            return self
+        try:
+            if self._remoteSystemHasPluginAPI():
+                return BugzillaLPPlugin(self.baseurl)
+            elif self._remoteSystemHasBugzillaAPI():
+                return BugzillaAPI(self.baseurl)
+        except (ProtocolError, URLError, BadStatusLine):
+            pass
+        return self
 
     def _parseDOMString(self, contents):
         """Return a minidom instance representing the XML contents supplied"""