From 40642ecaf4fde0ce3346838f453f47dce6eb89a6 Mon Sep 17 00:00:00 2001 From: "Dr. Peter Poeml" Date: Wed, 23 Apr 2008 07:07:45 +0000 Subject: [PATCH] save cookies even in case of urllib2.HTTPError exceptions [bnc#378421] --- osc/core.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osc/core.py b/osc/core.py index 323a638b..e14338fb 100755 --- a/osc/core.py +++ b/osc/core.py @@ -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()