Gregory P. Smith <g...@krypto.org> added the comment:

urlparse.urljoin and urlparse.urlsplit do not do what is required for 
this function.  urljoin does not collapse paths.  urlsplit has nothing 
to do with paths.

I agree r.david.murray that it is odd that it does two functions at once 
(the collapse and the split).  I wrote it specifically for its current 
use case when checking paths to cgi scripts.

The unittests for it describe the exact behavior it needs to implement.  
Trying to implement a separate collapse function is approximately the 
same amount of code because the edge cases such as
'/a/b/' and '/a/b/c/..' which both need to result in it returning 
('/a/b', '') instead of ('/a', 'b') are why it made sense to keep as a 
single function for its current use.

Unittests for the function already exist in Lib/test/test_httpservers.py  
to describe its full behavior.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5714>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to