[Python-Dev] Can ftp url start with file:// ?

Fred Drake fdrake at acm.org
Sun Jul 11 19:35:21 CEST 2010


On Sat, Jul 10, 2010 at 11:56 PM, Senthil Kumaran <orsenthil at gmail.com> wrote:
> I see the reason. But I doubt if this is a reliable approach.  Also
> when the scheme begins with file:// it should not be confused with
> ftp, so I think, that portion of code in urllib which work that way
> should be removed.

I'm not trying to defend the current behavior of defaulting to FTP as
a good thing; it's definitely surprising.  I am trying to rationalize
it so I can be sure I understand why it might have been done to start
with.

My own preference is to kick out any non-local references with an
exception that can be detected (possibly derived from ValueError) so
that applications that want rewrite (hopefully with user agreement!)
can do so.  (Checking for non-local file: URLs on input might be
better, of course.)


  -Fred

-- 
Fred L. Drake   <fdrake at acm.org>


More information about the Python-Dev mailing list