[twill] Bug? in HTTP Basic Authentication Handling

John J Lee jjl at pobox.com
Fri Mar 2 07:30:43 PST 2007


If you don't mind, please don't top-post, it's not really appropriate on 
open-source mailing lists.

On Fri, 2 Mar 2007, subscriptions at smart-knowhow.de wrote:
[...]
> I tried to figure out if the BasicAuth handler is called and came to the following code:
> 
> _opener.py (Lines 176 - 180):
> 
>         # In Python >= 2.4, .open() supports processors already, so we must
>         # call ._open() instead.
>         urlopen = getattr(urllib2.OpenerDirector, "_open",
>                           urllib2.OpenerDirector.open)
>         response = urlopen(self, req, data)
> 
> Here I'm lost... no idea why you copy most of the code of urllib2 and 
> then reuse some portions of it...

Because mechanize exports a superset of the urllib2 interface.  The number 
of extensions and fixes have grown over time.  I may just fork the whole 
thing later, but now isn't the time.


> But i don't have the python source of urllib2 and I can't dig deeper.

You do have the source of urllib2 -- look in your Python installation 
e.g. C:\Python24\Lib\urllib2.py, or /usr/{local/,}lib/python2.4/urllib2.py.


John


More information about the twill mailing list