summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Garland <johnnybg+deluge@gmail.com>2012-09-16 17:12:16 +1000
committerJohn Garland <johnnybg+deluge@gmail.com>2012-09-16 17:12:16 +1000
commit18eb885983b7f094ca4a2c0e95547a06f61ba7f0 (patch)
tree454831db1a96b54d9e8835e901b08a971219af46
parentcb661f2595f7d593377f11e574a857618bfb4d6a (diff)
downloaddeluge-18eb885983b7f094ca4a2c0e95547a06f61ba7f0.zip
deluge-18eb885983b7f094ca4a2c0e95547a06f61ba7f0.tar.gz
deluge-18eb885983b7f094ca4a2c0e95547a06f61ba7f0.tar.bz2
Don't use deprecated twisted imports (fixes #2164)
Aliases have been removed in twisted 12.2.0.
-rw-r--r--deluge/ui/tracker_icons.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/deluge/ui/tracker_icons.py b/deluge/ui/tracker_icons.py
index 91a02e4..a9d5528 100644
--- a/deluge/ui/tracker_icons.py
+++ b/deluge/ui/tracker_icons.py
@@ -39,7 +39,12 @@ from urlparse import urljoin, urlparse
from tempfile import mkstemp
from twisted.internet import defer, threads
-from twisted.web import error
+from twisted.web.error import PageRedirect
+try:
+ from twisted.web.resource import NoResource, ForbiddenResource
+except ImportError:
+ # twisted 8
+ from twisted.web.error import NoResource, ForbiddenResource
from deluge.component import Component
from deluge.configmanager import get_config_dir
@@ -235,7 +240,7 @@ class TrackerIcons(Component):
error_msg = f.getErrorMessage()
log.debug("Error downloading page: %s", error_msg)
d = f
- if f.check(error.PageRedirect):
+ if f.check(PageRedirect):
# Handle redirect errors
location = urljoin(self.host_to_url(host), error_msg.split(" to ")[1])
self.redirects[host] = url_to_host(location)
@@ -375,14 +380,14 @@ class TrackerIcons(Component):
error_msg = f.getErrorMessage()
log.debug("Error downloading icon: %s", error_msg)
d = f
- if f.check(error.PageRedirect):
+ if f.check(PageRedirect):
# Handle redirect errors
location = urljoin(self.host_to_url(host), error_msg.split(" to ")[1])
d = self.download_icon([(location, extension_to_mimetype(location.rpartition('.')[2]))] + icons, host)
if not icons:
d.addCallbacks(self.on_download_icon_complete, self.on_download_icon_fail,
callbackArgs=(host,), errbackArgs=(host,))
- elif f.check(error.NoResource, error.ForbiddenResource) and icons:
+ elif f.check(NoResource, ForbiddenResource) and icons:
d = self.download_icon(icons, host)
elif f.check(NoIconsError, HTMLParseError):
# No icons, try favicon.ico as an act of desperation