[Yum-devel] [UG] unicode filename prevents resume of download

Jimmy Do crispyleaves at gmail.com
Tue Jan 30 06:55:54 UTC 2007


Let's say I want to download a file with this piece of code:
g = URLGrabber()
g.urlgrab(some_url, filename=some_path, reget='simple')

I've noticed that if some_path is a unicode string, then a
partially-downloaded file will *not* be resumed. If some_path is an
ascii string, however, then a partial file will get resumed.

I believe that this piece of code at line 1197 in grabber.py is
causing this behavior:
if have_range and self.opts.reget and type(self.filename) == type(''):

type(self.filename) == type('') will only be true if self.filename is
an ascii string, so self.append will never be set to 1 if
self.filename is a unicode string. The solution would be to change
that to:
isinstance(self.filename, basestring)

I'm curious if this is a bug or intended behavior?


More information about the Yum-devel mailing list