~ubuntu-branches/ubuntu/saucy/horizon/saucy-security

« back to all changes in this revision

Viewing changes to openstack_dashboard/dashboards/project/volumes/views.py

  • Committer: Package Import Robot
  • Author(s): James Page, James Page, Chuck Short
  • Date: 2013-10-03 13:48:12 UTC
  • mfrom: (1.1.31)
  • Revision ID: package-import@ubuntu.com-20131003134812-2vkwosem4flwuk5y
Tags: 1:2013.2~rc1-0ubuntu1
[ James Page ]
* New upstream release candidate:
  - d/static: Refreshed static assets for 2013.2~rc1.
  - d/patches: Refreshed patches.

[ Chuck Short ]
* debian/control: Add python-lesscpy as a suggests to optionally
  support online compression of static assets (LP: #1226674).

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
from horizon import tables
28
28
from horizon import tabs
29
29
 
30
 
import logging
31
 
 
32
30
from openstack_dashboard import api
33
31
from openstack_dashboard.api import cinder
34
32
from openstack_dashboard.usage import quotas
42
40
    import tabs as project_tabs
43
41
 
44
42
 
45
 
LOG = logging.getLogger(__name__)
46
 
 
47
 
 
48
43
class VolumeTableMixIn(object):
49
44
    def _get_volumes(self, search_opts=None):
50
45
        try:
105
100
    def get_context_data(self, **kwargs):
106
101
        context = super(CreateView, self).get_context_data(**kwargs)
107
102
        try:
108
 
            context['usages'] = cinder.tenant_absolute_limits(self.request)
109
 
            volumes = cinder.volume_list(self.request)
110
 
            total_size = sum([getattr(volume, 'size', 0) for volume
111
 
                              in volumes])
112
 
            context['usages']['gigabytesUsed'] = total_size
113
 
            context['usages']['volumesUsed'] = len(volumes)
114
 
 
 
103
            context['usages'] = quotas.tenant_limit_usages(self.request)
115
104
        except Exception:
116
105
            exceptions.handle(self.request)
117
106
        return context
126
115
        context = super(CreateSnapshotView, self).get_context_data(**kwargs)
127
116
        context['volume_id'] = self.kwargs['volume_id']
128
117
        try:
129
 
            context['usages'] = quotas.tenant_quota_usages(self.request)
 
118
            context['usages'] = quotas.tenant_limit_usages(self.request)
130
119
        except Exception:
131
120
            exceptions.handle(self.request)
132
121
        return context