This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Keto
Recipients Keto
Date 2011-12-09.15:54:41
SpamBayes Score 1.2417291e-05
Marked as misclassified No
Message-id <1323446082.73.0.0465562779799.issue13567@psf.upfronthosting.co.za>
In-reply-to
Content
In case of authentication error, HTTPError gets initialized without file object and constructor of addinfourl is not called. This means that url attribute is not set and geturl() (inherited from addinfourl) raises AttributeError.

geturl() is not documented as part of HTTPError interface, so I'm not sure if it is correct to expect it to work. And of course this can be worked around by using the HTTPError.filename which always contains the url passed to constructor.

How ever, I have made a simple patch to fix the missing attribute.


There is also Issue5286 with a patch, which makes the http_error_auth_reqed pass the fp to HTTPError making it a file-like object as stated in the documentation. So that would probably be the correct solution.

IMHO it's a bit bad design, when objects interface changes depending on how it was initialized.
History
Date User Action Args
2011-12-09 15:54:42Ketosetrecipients: + Keto
2011-12-09 15:54:42Ketosetmessageid: <1323446082.73.0.0465562779799.issue13567@psf.upfronthosting.co.za>
2011-12-09 15:54:42Ketolinkissue13567 messages
2011-12-09 15:54:41Ketocreate