mirror of
https://git.deluge-torrent.org/deluge
synced 2025-04-20 11:35:49 +00:00
Use cStringIO to open zip files in python 2.5
This commit is contained in:
parent
34b2ada0db
commit
5a35d60178
2 changed files with 8 additions and 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.
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue