[Twisted-Python] Re: client crashed
Andrew, 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 bulletproof. 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 else: defaultPort = 80 host, port = parsed[1], defaultPort if ':' in host: host, port = host.split(':') try: 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 twisted. 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: http://www.advanced-app.com.hk/MiscJunk/UrlSplitAndUnSplit.txt 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. Thanks, Rick
On Sat, 13 Jan 2007 16:15:01 -0600, Rick Graves <gravesricharde@yahoo.com> wrote: [...]
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.
I don't think this is a bug. It's a given that you don't give Twisted junk input. And if you do you should catch any errors that may result. _parse() isn't special in this regard. Cleaning up input is a job for UI components and other things that are "higher up" than Twisted. Regards, -- Eric Mangold Twisted/Win32 Co-Maintainer
On Sat, Jan 13, 2007 at 02:15:01PM -0800, Rick Graves wrote:
Andrew,
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 bulletproof.
Specifically, perhaps _parse() should be changed as follows (4 out of the last 5 lines are different):
Ah, I didn't realise from your original message that _parse was part of Twisted, rather than your own code. -Andrew.
participants (3)
-
Andrew Bennetts
-
Eric Mangold
-
Rick Graves