[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

What does this bogus code in urlparse do?

John Nagle

2/26/2008 5:04:00 AM

See "http://svn.python.org/view/python/trunk/Lib/urlparse.py?rev=60163&view=ma...

Look at "urljoin".

What does the code marked "# XXX The stuff below is bogus in various
ways..." do?

I think it's an attempt to remove leading "../" components in URLs, which are
generally ignored. But it also does something with commas, and it's not
clear why.

John Nagle
1 Answer

Chris Mellon

2/26/2008 4:28:00 PM

0

On Mon, Feb 25, 2008 at 11:04 PM, John Nagle <nagle@animats.com> wrote:
> See "http://svn.python.org/view/python/trunk/Lib/urlparse.py?rev=60163&view=ma...
>
> Look at "urljoin".
>
> What does the code marked "# XXX The stuff below is bogus in various
> ways..." do?
>
> I think it's an attempt to remove leading "../" components in URLs, which are
> generally ignored. But it also does something with commas, and it's not
> clear why.
>
> John Nagle
> --

You should probably invest in syntax highlighting ;), it doesn't do
anything with commas (just '.', '..' , and ''). It appears to be
trying to normalize relative URLs into a single absolute one, as the
docstring implies.