mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-04 07:28:39 +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
|
* Minor speedup in parsing blocklists
|
||||||
* Blocklist now attempts to download the URL multiple times before giving
|
* Blocklist now attempts to download the URL multiple times before giving
|
||||||
up
|
up
|
||||||
|
* Fix blocklist not being able to open zipped blocklists with python 2.5
|
||||||
|
|
||||||
==== Web ====
|
==== Web ====
|
||||||
* Put the default password in the manpage.
|
* Put the default password in the manpage.
|
||||||
|
|
|
@ -39,7 +39,13 @@ def Zipped(reader):
|
||||||
"""Blocklist reader for zipped blocklists"""
|
"""Blocklist reader for zipped blocklists"""
|
||||||
def open(self):
|
def open(self):
|
||||||
z = zipfile.ZipFile(self.file)
|
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
|
reader.open = open
|
||||||
return reader
|
return reader
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue