[Python-Dev] bug in urlparse

Fabien Schwob skink at evhr.net
Sun Sep 4 17:17:12 CEST 2005


>> >>> import urlparse
>> >>> begin = "http://www.example.com/folder/page.html"
>> >>> end = "../../../otherpage.html"
>> >>> urlparse.urljoin(begin, end)
>>'http://www.example.com/../../otherpage.html'

> You seem to be typing this from memory; the example actually gives a
> single set of "../", not two.

No, it's a copy of an interactive session using Python 2.4.1.

>>I would more expect the following url :
>>http://www.example.com/otherpage.html
>>
>>It's what is done in most web browser.
>>
>>So I would like to know if it's a bug or not. If it is, I would try to
>>code and to submit a patch.

> You shouldn't be giving more "../" sequences than are possible. I find
> the current behavior acceptable.

Ok, so I would try do dev my own fonction. Mainly because on some web 
pages that I manipulate (for example [1]) there are more "../" than 
possible.

[1] http://linuxfr.org/~pterjan/19252.html

-- 
Fabien SCHWOB




More information about the Python-Dev mailing list