don't use zipfile's context manager as it won't work on py2.6

Fixes bug: 955994

Change-Id: I436c667f496b10d64281538692acc10e327a8fdf
This commit is contained in:
Ionuț Arțăriși 2012-03-14 17:36:33 +01:00
parent 75053c8222
commit 53f15d9424
2 changed files with 3 additions and 1 deletions

View File

@ -16,6 +16,7 @@ Gabriel Hurley <gabriel@strikeawe.com>
Ghe Rivero <ghe@debian.org>
Greg Althaus <galthaus@austin.rr.com>
Hengqing Hu <hudayou@hotmail.com>
Ionuț Arțăriși <iartarisi@suse.cz>
Ivan Kolodyazhny <e0ne@e0ne.info>
Jake Dahn <jake@ansolabs.com>
Jake Zukowski <jake@ponyloaf.com>

View File

@ -17,6 +17,7 @@
import logging
import tempfile
import zipfile
from contextlib import closing
from django import http
from django.template.loader import render_to_string
@ -87,7 +88,7 @@ class DownloadX509Credentials(forms.SelfHandlingForm):
try:
temp_zip = tempfile.NamedTemporaryFile(delete=True)
with zipfile.ZipFile(temp_zip.name, mode='w') as archive:
with closing(zipfile.ZipFile(temp_zip.name, mode='w')) as archive:
archive.writestr('pk.pem', credentials.private_key)
archive.writestr('cert.pem', credentials.data)
archive.writestr('cacert.pem', cacert.data)