On Thu, 2012-07-12 at 17:47 +0200, Zdeněk Pavlas wrote: > urlgrab() should return url instead of filename if copying > was skipped, but the async path cannot alter the return value, > and we can't detect file:// URLs until we have selected a mirror. > > Use 1st mirror temporarily and call the non-mirrored urlgrab() > to handle this special case immediately. Otherwise, request > is queued and the filename arg is returned. > --- > urlgrabber/mirror.py | 18 +++++++++--------- > 1 files changed, 9 insertions(+), 9 deletions(-) > > diff --git a/urlgrabber/mirror.py b/urlgrabber/mirror.py > index d699b61..f2b5288 100644 > --- a/urlgrabber/mirror.py > +++ b/urlgrabber/mirror.py > @@ -408,15 +408,15 @@ class MirrorGroup: > > def urlgrab(self, url, filename=None, **kwargs): > if kwargs.get('async'): > - opts = self.grabber.opts.derive(**kwargs) > - opts.mirror_group = self, set() > - opts.relative_url = _to_utf8(url) > - > - opts.url = 'http://tbd' > - opts.filename = filename > - opts.size = int(opts.size or 0) > - _async_queue.append(opts) > - return filename > + return self.grabber.urlgrab( > + # use 1st mirror to handle the file:// && copy_local==0 case > + self._join_url(self.mirrors[0]['mirror'], url), > + filename, > + # enable mirror failovers in async path > + mirror_group = (self, set()), > + relative_url = url, > + **kwargs > + )
If we just delete this whole block it does: > > kw = dict(kwargs) > kw['filename'] = filename func = 'urlgrab' try: return self._mirror_try(func, url, kw) except URLGrabError, e: ...and mirror_try looks like it does something very similar to the new code above ... so can we just delete it?
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Yum-devel mailing list Yum-devel@lists.baseurl.org http://lists.baseurl.org/mailman/listinfo/yum-devel