1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-26 12:12:11 +01:00

save cookies even in case of urllib2.HTTPError exceptions [bnc#378421]

This commit is contained in:
Dr. Peter Poeml 2008-04-23 07:07:45 +00:00
parent a4f4488a50
commit 40642ecaf4

View File

@ -1385,12 +1385,15 @@ def http_request(method, url, headers={}, data=None, file=None):
else:
raise
# this handling is currently considered as temporary workaround, bug #378421
try:
fd = urllib2.urlopen(req, data=data)
finally:
except urllib2.HTTPError:
# make sure that cookies are saved nevertheless
if hasattr(conf.cookiejar, 'save'):
conf.cookiejar.save(ignore_discard=True)
# handle the exception elsewhere
raise
if filefd: filefd.close()