~ubuntu-branches/ubuntu/saucy/horizon/saucy-updates

« back to all changes in this revision

Viewing changes to openstack_dashboard/dashboards/project/access_and_security/api_access/views.py

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman
  • Date: 2013-09-06 11:59:43 UTC
  • mfrom: (1.1.30)
  • Revision ID: package-import@ubuntu.com-20130906115943-h3td0l7tp16mb9oc
Tags: 1:2013.2~b3-0ubuntu1
* New upstream release.
* debian/control: Minimum python-openstack-auth version >= 1.1.1.
* debian/control: Add python-troveclient.
* debian/static: Refresh static assets for 2013.2~b3.
* debian/patches: ubuntu_local_settings.patch -> ubuntu_settings.patch, also
  patch location of secret key in openstack_dashboard/settings.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
#    License for the specific language governing permissions and limitations
15
15
#    under the License.
16
16
 
17
 
from contextlib import closing
 
17
from contextlib import closing  # noqa
18
18
import logging
19
19
import tempfile
20
20
import zipfile
21
21
 
22
22
from django import http
23
23
from django import shortcuts
24
 
from django.template.loader import render_to_string
25
 
from django.utils.translation import ugettext_lazy as _
 
24
from django.template.loader import render_to_string  # noqa
 
25
from django.utils.translation import ugettext_lazy as _  # noqa
26
26
 
27
27
from horizon import exceptions
28
28
from horizon import messages
52
52
            keys = api.keystone.create_ec2_credentials(request,
53
53
                                                       request.user.id,
54
54
                                                       tenant_id)
55
 
    except:
 
55
    except Exception:
56
56
        exceptions.handle(request,
57
57
                          _('Unable to fetch EC2 credentials.'),
58
58
                          redirect=request.build_absolute_uri())
88
88
            archive.writestr('cert.pem', credentials.data)
89
89
            archive.writestr('cacert.pem', cacert.data)
90
90
            archive.writestr('ec2rc.sh', render_to_string(template, context))
91
 
    except:
 
91
    except Exception:
92
92
        exceptions.handle(request,
93
93
                          _('Error writing zipfile: %(exc)s'),
94
94
                          redirect=request.build_absolute_uri())
97
97
    response = http.HttpResponse(mimetype='application/zip')
98
98
    response.write(temp_zip.read())
99
99
    response['Content-Disposition'] = ('attachment; '
100
 
                                       'filename=%s-x509.zip'
 
100
                                       'filename="%s-x509.zip"'
101
101
                                       % tenant_name)
102
102
    response['Content-Length'] = temp_zip.tell()
103
103
    return response
124
124
                                    context,
125
125
                                    content_type="text/plain")
126
126
        response['Content-Disposition'] = ('attachment; '
127
 
                                           'filename=%s-openrc.sh'
 
127
                                           'filename="%s-openrc.sh"'
128
128
                                           % tenant_name)
129
129
        response['Content-Length'] = str(len(response.content))
130
130
        return response