diff options
author | John Garland <johnnyg@gmail.com> | 2010-01-07 15:27:05 +0000 |
---|---|---|
committer | John Garland <johnnyg@gmail.com> | 2010-01-07 15:27:05 +0000 |
commit | 5a35d6017850ecf5ab09670074c81a68f1768fc8 (patch) | |
tree | e0bb15eddcbfeda4beaf321fb0752495250f87d9 | |
parent | 34b2ada0dbe1327ed52388789acff0c3a028849c (diff) | |
download | deluge-5a35d6017850ecf5ab09670074c81a68f1768fc8.tar.gz deluge-5a35d6017850ecf5ab09670074c81a68f1768fc8.tar.bz2 deluge-5a35d6017850ecf5ab09670074c81a68f1768fc8.zip |
Use cStringIO to open zip files in python 2.5
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | deluge/plugins/blocklist/blocklist/decompressers.py | 8 |
2 files changed, 8 insertions, 1 deletions
@@ -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 |