1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-12 23:56:13 +01:00

- conf.py: workaround for urllib2: reset basic auth retry count if a 404 is encountered

normally we should also do this for all status codes != 401 but so far
it seems to be sufficient to do it only for 404
This commit is contained in:
Marcus Huewe 2011-04-06 17:23:48 +02:00
parent b7328b6adf
commit b8c3a23b90

View File

@ -411,6 +411,17 @@ def _build_opener(url):
self.retried = 0
return response
def http_error_404(self, *args):
self.retried = 0
return None
authhandler_class = OscHTTPBasicAuthHandler
elif sys.version_info >= (2, 6, 6) and sys.version_info < (2, 7, 1):
class OscHTTPBasicAuthHandler(urllib2.HTTPBasicAuthHandler):
def http_error_404(self, *args):
self.reset_retry_count()
return None
authhandler_class = OscHTTPBasicAuthHandler
elif sys.version_info >= (2, 6, 5) and sys.version_info < (2, 6, 6):
# workaround for broken urllib2 in python 2.6.5: wrong credentials