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

This commit is contained in:
Jenkins 2012-03-20 15:48:26 +00:00 committed by Gerrit Code Review
commit e42a70aeed
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)