[Twisted-Python] Re: client crashed

Rick Graves gravesricharde at yahoo.com
Sat Jan 13 17:15:01 EST 2007


Thanks for the feedback. 

BTW, I am new to twisted but not to python.

> Anyway, there's nothing Twisted specific here that I
can see.

I disagree -- I was trying to make a suggestion that
would make future releases of twisted more

Specifically, perhaps _parse() should be changed as
follows (4 out of the last 5 lines are different):

def _parse(url, defaultPort=None):
    parsed = urlparse.urlparse(url)
    scheme = parsed[0]
    path = urlparse.urlunparse(('','')+parsed[2:])
    if defaultPort is None:
        if scheme == 'https':
            defaultPort = 443
            defaultPort = 80
    host, port = parsed[1], defaultPort
    if ':' in host:
        host, port = host.split(':')
             port = int(port)
        except ValueError:
             port = defaultPort
    return scheme, host, port, path

But I will not change the copy of client.py on my
computer.  I worked around this problem by making sure
all the URL's were clean before giving them to

Going at this from the top down (or bottom up,
depending on your perspective):

lURLs = map( GetCleanURL, lURLs )

def GetCleanURL( sURL ):
    return UrlUnSplitMore( UrlSplitMore( sURL ) )

UrlUnSplitMore and UrlSplitMore have longer lines
which this mail client would wrap, and the result
would look terrible.  In case you are interested, they
are in this plain text file:


Maybe I am making a suggestion to change twisted in
the wrong place.  I will try posting my suggested
change as a "bug" -- client.py crashes on a URL that
most browsers clean up automatically with no problem. 



More information about the Twisted-Python mailing list