← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stub/launchpad/production into lp:~launchpad-pqm/launchpad/production-devel

 

Stuart Bishop has proposed merging lp:~stub/launchpad/production into lp:~launchpad-pqm/launchpad/production-devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


Python 2.5 raises OSError from urlopen if a local file isn't found. Python 2.6 wraps the OSError and raises a URLError.
-- 
https://code.launchpad.net/~stub/launchpad/production/+merge/37482
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stub/launchpad/production into lp:~launchpad-pqm/launchpad/production-devel.
=== modified file 'lib/lp/services/scripts/base.py'
--- lib/lp/services/scripts/base.py	2010-09-17 04:45:30 +0000
+++ lib/lp/services/scripts/base.py	2010-10-04 15:06:03 +0000
@@ -338,6 +338,14 @@
             return True
         log.exception("Error loading %s" % control_url)
         return True
+    # Python 2.5 can return OSError. Under 2.6, this is wrapped into a
+    # URLError.
+    except OSError, error:
+        if error.errno == 2:
+            log.debug("Cronscript control file not found at %s", control_url)
+            return True
+        log.exception("Error loading %s" % control_url)
+        return True
     except URLError, error:
         if getattr(error.reason, 'errno', None) == 2:
             log.debug("Cronscript control file not found at %s", control_url)


Follow ups