[Apt-offline-devel] [SCM] Offline APT Package Manager branch, master, updated. 0.9.4-14-gac75ecd
Ritesh Raj Sarraf
rrs at researchut.com
Tue Oct 27 07:59:27 UTC 2009
The following commit has been merged in the master branch:
commit ac75ecd3ed58ebe1783f0757b1d0ea6237215a06
Author: Ritesh Raj Sarraf <rrs at researchut.com>
Date: Tue Oct 27 13:27:59 2009 +0530
Handle 504 Gateway timeouts more robustly
urllib2.URLError can throw an exception for Gateway Timeouts without
an errcode. Check to see if the errcode is provided. If it is None,
we make the assumption that it was a Gateway Timeout
diff --git a/AptOfflineCoreLib.py b/AptOfflineCoreLib.py
index 7d92e3f..e499364 100644
--- a/AptOfflineCoreLib.py
+++ b/AptOfflineCoreLib.py
@@ -270,9 +270,16 @@ class DownloadFromWeb(AptOfflineLib.ProgressBar):
except urllib2.HTTPError, errstring:
errfunc(errstring.code, errstring.msg, url)
except urllib2.URLError, errstring:
- # URLErrors shouldn't be ignored, hence program termination
- if errstring.reason.args[0] == 10060:
- errfunc(errstring.reason.args[0], errstring.reason, url)
+ #INFO: Weird. But in urllib2.URLError, I noticed that for
+ # error type "timeouts", no errno was defined.
+ # errstring.errno was listed as None
+ # In my tests, wget categorized this behavior as:
+ # 504: gateway timeout
+ # So I am doing the same here.
+ if errstring.errno is None:
+ errfunc(504, errstring.reason, url)
+ else:
+ errfunc(errstring.errno, errstring.reason, url)
except IOError, e:
if hasattr(e, 'reason'):
log.err("%s\n" % (e.reason))
--
Offline APT Package Manager
More information about the Apt-offline-devel
mailing list