New submission from Pami Ketolainen pami.ketolai...@gmail.com:
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.
--
components: Library (Lib)
files: httperror-geturl-fix-2.patch
keywords: patch
messages: 149106
nosy: Keto
priority: normal
severity: normal
status: open
title: HTTPError interface changes / breaks depending on what was passed to
constructor
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file23892/httperror-geturl-fix-2.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13567
___
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com