The urlparse module's ways of splitting the location into hostname and
port breaks with RFC2732 style URIs with IPv6 addresses in them:
>>> import urlparse
>>> urlparse.urlparse('http://[::1]:80/').hostname
'['
>>> urlparse.urlparse('http://[::1]:80/').port
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/urlparse.py", line 116, in port
return int(port, 10)
ValueError: invalid literal for int() with base 10: ':1]:80'
>>>
A simple fix is attached, but probably requires a little more thought.