summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--deluge/plugins/blocklist/blocklist/decompressers.py8
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2cf45bd83..6ebff21cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,6 +28,7 @@
* Minor speedup in parsing blocklists
* Blocklist now attempts to download the URL multiple times before giving
up
+ * Fix blocklist not being able to open zipped blocklists with python 2.5
==== Web ====
* Put the default password in the manpage.
diff --git a/deluge/plugins/blocklist/blocklist/decompressers.py b/deluge/plugins/blocklist/blocklist/decompressers.py
index df3ac0c35..ccc4dfc21 100644
--- a/deluge/plugins/blocklist/blocklist/decompressers.py
+++ b/deluge/plugins/blocklist/blocklist/decompressers.py
@@ -39,7 +39,13 @@ def Zipped(reader):
"""Blocklist reader for zipped blocklists"""
def open(self):
z = zipfile.ZipFile(self.file)
- return z.open(z.namelist()[0])
+ if hasattr(z, 'open'):
+ f = z.open(z.namelist()[0])
+ else:
+ # Handle python 2.5
+ import cStringIO
+ f = cStringIO.StringIO(z.read(z.namelist()[0]))
+ return f
reader.open = open
return reader