[Yum-devel] urlgrabber request

Michael Stenner mstenner at linux.duke.edu
Fri Aug 13 23:36:17 UTC 2004


On Fri, Aug 13, 2004 at 01:26:37AM -0400, seth vidal wrote:
> > 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.

Agreed.  I'm convinced to do something like this.  For consistentcy,
I'd like to use the same format for all callbacks.  My only question
is whether to use a dict (it's universal and simple) or to use a
custom object.  I usually lean toward the custom object route.

I probably should have gone this route in the first place.  The only
thing holding me back now is that it breaks compatibility, but given
our alpha status, I really shouldn't let that bother me now.  I'd like
to hear Ryan's thoughts on the issue.

> > 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.

Agreed, and

  def cb(obj):
      raise obj.exception

is even easier :)

					-Michael

-- 
  Michael D. Stenner                            mstenner at ece.arizona.edu
  ECE Department, the University of Arizona                 520-626-1619
  1230 E. Speedway Blvd., Tucson, AZ 85721-0104                 ECE 524G



More information about the Yum-devel mailing list