Merge "don't use zipfile's context manager as it won't work on py2.6"
This commit is contained in:
commit
e42a70aeed
1
AUTHORS
1
AUTHORS
@ -16,6 +16,7 @@ Gabriel Hurley <gabriel@strikeawe.com>
|
|||||||
Ghe Rivero <ghe@debian.org>
|
Ghe Rivero <ghe@debian.org>
|
||||||
Greg Althaus <galthaus@austin.rr.com>
|
Greg Althaus <galthaus@austin.rr.com>
|
||||||
Hengqing Hu <hudayou@hotmail.com>
|
Hengqing Hu <hudayou@hotmail.com>
|
||||||
|
Ionuț Arțăriși <iartarisi@suse.cz>
|
||||||
Ivan Kolodyazhny <e0ne@e0ne.info>
|
Ivan Kolodyazhny <e0ne@e0ne.info>
|
||||||
Jake Dahn <jake@ansolabs.com>
|
Jake Dahn <jake@ansolabs.com>
|
||||||
Jake Zukowski <jake@ponyloaf.com>
|
Jake Zukowski <jake@ponyloaf.com>
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
import logging
|
import logging
|
||||||
import tempfile
|
import tempfile
|
||||||
import zipfile
|
import zipfile
|
||||||
|
from contextlib import closing
|
||||||
|
|
||||||
from django import http
|
from django import http
|
||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
@ -87,7 +88,7 @@ class DownloadX509Credentials(forms.SelfHandlingForm):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
temp_zip = tempfile.NamedTemporaryFile(delete=True)
|
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('pk.pem', credentials.private_key)
|
||||||
archive.writestr('cert.pem', credentials.data)
|
archive.writestr('cert.pem', credentials.data)
|
||||||
archive.writestr('cacert.pem', cacert.data)
|
archive.writestr('cacert.pem', cacert.data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user