[Yum-devel] urlgrabber request

seth vidal skvidal at phy.duke.edu
Fri Aug 13 05:26:37 UTC 2004


>   def cb(e, url):
>       print "failed to get %" % url
> 
>   filename = mg.urlgrab(url, filename, failure_callback=(cb, (url,), {}))

I can live with this for the filename.


> > If you're using the standard progress meter and a simple failure
> > callback, you'll never know what file it is failing on b/c the exception
> > doesn't include the filename or mirror name anywhere.
> 
> Now, the mirror is tougher.  I'm open to suggestions here.  I don't
> really like the idea of "packing the exception".  I'd prefer to leave
> that untouched.  However, it might be reasonable to pass back some
> other structure that CONTAINS the exception.  I could then also
> contain other information about what was going on.  For example:
> 
>   {'exception': e, 'url': url, 'mirror': mirror_url}

I think this would be the best way. The information as to which mirror
fails is important and valuable feedback for the user.


> Now, I'd like to try and keep things uniform across all of the
> callbacks in grabber.py (which has both failure_callback and
> checkfunc) and mirror.py.  One side effect of this idea that I don't
> like is that you can no longer simplly do:
> 
>   def cb(e):
>       raise

I'm not deeply worried about not being able to use the above callback.

Especially not when you can do:

 def cb(obj):
    raise obj['exception']

and get the same result.

-sv





More information about the Yum-devel mailing list