From 53f15d9424bd6137baf98187215520abb6c545cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionu=C8=9B=20Ar=C8=9B=C4=83ri=C8=99i?= Date: Wed, 14 Mar 2012 17:36:33 +0100 Subject: [PATCH] don't use zipfile's context manager as it won't work on py2.6 Fixes bug: 955994 Change-Id: I436c667f496b10d64281538692acc10e327a8fdf --- AUTHORS | 1 + horizon/dashboards/settings/ec2/forms.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 4decac605a..df96910d19 100644 --- a/AUTHORS +++ b/AUTHORS @@ -16,6 +16,7 @@ Gabriel Hurley Ghe Rivero Greg Althaus Hengqing Hu +Ionuț Arțăriși Ivan Kolodyazhny Jake Dahn Jake Zukowski diff --git a/horizon/dashboards/settings/ec2/forms.py b/horizon/dashboards/settings/ec2/forms.py index d3e55196a0..bbacb01240 100644 --- a/horizon/dashboards/settings/ec2/forms.py +++ b/horizon/dashboards/settings/ec2/forms.py @@ -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)