[utils] I18N: fix for Python 2.6

Using zipfile directly as a context manager is not supported until
Python 2.7
This commit is contained in:
Yen Chi Hsuan 2016-01-17 17:09:39 +08:00
parent 1aee79da3e
commit b42444d38b

View File

@ -2541,7 +2541,7 @@ class I18N(object):
except KeyError:
zinfo = None
if zinfo is not None:
with zipf.open(zinfo) as mo_file:
with contextlib.closing(zipf.open(zinfo)) as mo_file:
t = gettext.GNUTranslations(mo_file)
zipf.close()
return t