[Patches] [ python-Patches-972322 ] urllib2 handler naming convention collision

SourceForge.net noreply at sourceforge.net
Thu May 19 22:53:16 CEST 2005


Patches item #972322, was opened at 2004-06-14 00:16
Message generated for change (Comment added) made by jjlee
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=972322&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: John J Lee (jjlee)
Assigned to: Jeremy Hylton (jhylton)
Summary: urllib2 handler naming convention collision

Initial Comment:
The method naming conventions of *_open and *_request
in urllib2 are accidentally met by the following methods:

AbstractHTTPHandler.do_open()
ProxyHandler.proxy_open()
AbstractHTTPHandler.redirect_request()

So URLs like do://example.com/ are regarded as having a
handler, and urllib2.urlopen("do://python.org/") causes
a TypeError.

I think *something* should be done about this, but I'm
willing to provide a different patch if this one is
frowned upon.  The alternative would be to rename
do_open and proxy_open, and leave the redirect_request
case unchanged (see below for why).

The first two methods are undocumented, so could in
theory be renamed.  However, people will likely be
overriding them anyway, so perhaps it's better to apply
this ugly patch than rename them.

redirect_request is documented, so can't be renamed,
but it will never be accidentally called unless
somebody actually adds a handler with a method named
"redirect_open".


----------------------------------------------------------------------

>Comment By: John J Lee (jjlee)
Date: 2005-05-19 21:53

Message:
Logged In: YES 
user_id=261020

Since nobody seems to mind the slightly uglified code
required to fix these bugs in a backwards-compatible way,
could somebody please apply this patch?


----------------------------------------------------------------------

Comment By: Michael Chermside (mcherm)
Date: 2004-10-22 17:36

Message:
Logged In: YES 
user_id=99874

I have reviewed this patch and I recomend applying it.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=972322&group_id=5470


More information about the Patches mailing list