[Yum-devel] urlgrabber: timestamp check
Michael Stenner
mstenner at linux.duke.edu
Wed Mar 9 22:36:18 UTC 2005
On Wed, Mar 09, 2005 at 05:11:55PM -0500, Ryan Tomayko wrote:
> On Mar 9, 2005, at 12:28 PM, Michael Stenner wrote:
> >OK, I'm attaching both a patch to grabber.py and a little test program
> >to demonstrate how one might do this. I'd really like input from you
> >and Ryan about whether this makes sense. For the newly defined Error
> >number (which is for HTTPError), I've included special "code" and
> >"exception" attributes, which seems a little kludgy.
>
> I don't think it's kludgy at all.
Hmm... OK.
> >However, I do kinda like returning a bit more information. Before,
> >the same
> >exception got raised as IOError and the code/message were just encoded
> >in the string. That's OK to a user but it makes it hard to do things
> >like this.
> Yea. Not sure why we didn't do this in the first place.
OK, I'll tell you what. I'll go through and start doing this
EVERYWHERE it makes sense. I think that's what bothered me the
most... just having this be special. I'm pretty sure there won't be
need for any compat breaks.
> >The only other way I thought of to solve the problem was to allow
> >callers to include custom urllib2 handlers. That would really allow
> >a lot more flexibility, but I'd want to do it right, and that might
> >take a little thought.
>
> I added that a while back. Not sure I like the way we did it though:
>
> opener = None
>
> Overrides the default urllib2.OpenerDirector provided to urllib2
> when making requests. This option exists so that the urllib2
> handler chain may be customized. Note that the range, reget,
> proxy, and keepalive features require that custom handlers be
> provided to urllib2 in order to function properly. If an opener
> option is provided, no attempt is made by urlgrabber to ensure
> chain integrity. You are responsible for ensuring that any
> extension handlers are present if said features are required.
>
> Not something for the feint of heart.
Yeah, I'd forgotten about that option. That's not exactly what I
mean simply because you do have to do SO MUCH yourself if you go that
way. I'll think about it and see if there's a fast, simple way to
just add handlers without overriding everything.
> I'd say go ahead and commit it. I don't see any downside and you fixed
> a localization issue in there too :)
Well, I didn't really fix any localization issue. It's just that
localizing '%s' doesn't really work, so I turned localization off :)
-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