From: Michael Tremer Date: Thu, 28 Feb 2013 15:01:16 +0000 (+0100) Subject: More urlgrabber fixes for Ubuntu/Debian/Mint. X-Git-Tag: 0.9.25~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bbd51f5844f2ca13465e5064f03dad32095a6b5e;p=pakfire.git More urlgrabber fixes for Ubuntu/Debian/Mint. --- diff --git a/python/pakfire/downloader.py b/python/pakfire/downloader.py index d9808597d..41aa529ac 100644 --- a/python/pakfire/downloader.py +++ b/python/pakfire/downloader.py @@ -103,10 +103,18 @@ class PakfireGrabber(URLGrabber): def urlopen(self, filename, *args, **kwargs): self.check_offline_mode() - # However, urlopen requires the filename to be an ordinary string object. - filename = str(filename) + # This is for older versions of urlgrabber which are packaged in Debian + # and Ubuntu and cannot handle filenames as a normal Python string but need + # a unicode string. + return URLGrabber.urlopen(self, filename.encode("utf-8"), *args, **kwargs) + + def urlgrab(self, url, *args, **kwargs): + self.check_offline_mode() - return URLGrabber.urlopen(self, filename, *args, **kwargs) + # This is for older versions of urlgrabber which are packaged in Debian + # and Ubuntu and cannot handle filenames as a normal Python string but need + # a unicode string. + return URLGrabber.urlgrab(self, url.encode("utf-8"), *args, **kwargs) class PackageDownloader(PakfireGrabber):