summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Resch <andrewresch@gmail.com>2013-08-06 18:52:59 -0700
committerAndrew Resch <andrewresch@gmail.com>2013-08-06 18:52:59 -0700
commit06ee112344f7f32fdcfd9ce64eca750524382584 (patch)
treee377fc5f4538ff11942b558064f52c48120bb0d2
parent3cc43f63a0b049c5702765c3c3e2aacf3ec8fd5a (diff)
downloaddeluge-06ee112344f7f32fdcfd9ce64eca750524382584.tar.gz
deluge-06ee112344f7f32fdcfd9ce64eca750524382584.tar.bz2
deluge-06ee112344f7f32fdcfd9ce64eca750524382584.zip
Fix twisted 13.1 compat -- the _parse() function was replaced by the _URI class
-rw-r--r--deluge/httpdownloader.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/deluge/httpdownloader.py b/deluge/httpdownloader.py
index a4b335299..87bc9cd0c 100644
--- a/deluge/httpdownloader.py
+++ b/deluge/httpdownloader.py
@@ -192,7 +192,17 @@ def download_file(url, filename, callback=None, headers=None, force_filename=Fal
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