diff options
author | Andrew Resch <andrewresch@gmail.com> | 2013-08-06 18:51:33 -0700 |
---|---|---|
committer | Andrew Resch <andrewresch@gmail.com> | 2013-08-06 18:51:33 -0700 |
commit | 852f6049bd0b5bf31c8c578b8e112108239847ea (patch) | |
tree | ceca45aa9dd93519993eef7a21dfcfc8e3cd207c | |
parent | 289730a3e32c80332447a51d7c6c366c2aa78ae7 (diff) | |
download | deluge-852f6049bd0b5bf31c8c578b8e112108239847ea.tar.gz deluge-852f6049bd0b5bf31c8c578b8e112108239847ea.tar.bz2 deluge-852f6049bd0b5bf31c8c578b8e112108239847ea.zip |
Fix twisted 13.1 compat -- the _parse() function was replaced by the _URI class
-rw-r--r-- | deluge/httpdownloader.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/deluge/httpdownloader.py b/deluge/httpdownloader.py index 3f3467a72..4cc5cb1ce 100644 --- a/deluge/httpdownloader.py +++ b/deluge/httpdownloader.py @@ -196,7 +196,17 @@ def download_file(url, filename, callback=None, headers=None, headers = {} headers["accept-encoding"] = "deflate, gzip, x-gzip" - scheme, host, port, path = client._parse(url) + # In twisted 13.1.0 the _parse() function was replaced by the _URI class + if hasattr(client, '_parse'): + scheme, host, port, path = client._parse(url) + else: + from twisted.web import _URI + uri = _URI.fromBytes(url) + scheme = uri.scheme + host = uri.host + port = uri.port + path = uri.originFrom + factory = HTTPDownloader(url, filename, callback, headers, force_filename, allow_compression) if scheme == "https": from twisted.internet import ssl |