[Python-Dev] Path object design

Fredrik Lundh fredrik at pythonware.com
Mon Nov 6 14:59:06 CET 2006


Martin v. Löwis wrote:

> Andrew Dalke schrieb:
>>>>> urlparse.urljoin("http://blah.com/", "..")
>> 'http://blah.com/'
>>>>> urlparse.urljoin("http://blah.com/", "../")
>> 'http://blah.com/../'
>>>>> urlparse.urljoin("http://blah.com/", "../..")
>> 'http://blah.com/'
>>
>> Does the result make sense to you?  Does it make
>> sense that the last of these is shorter than the middle
>> one?  It sure doesn't to me.  I thought it was obvious
>> that there was an error;
> 
> That wasn't obvious at all to me. Now looking at the
> examples, I agree there is an error. The middle one
> is incorrect;
> 
> urlparse.urljoin("http://blah.com/", "../")
> 
> should also give 'http://blah.com/'.

make that: could also give 'http://blah.com/'.

as I said, today's urljoin doesn't guarantee that the output is
the *shortest* possible way to represent the resulting URI.

</F>



More information about the Python-Dev mailing list