Пример #1
0
 def get_share_quotas_data(self):
     request = self.tab_group.request
     tenant_id = request.user.tenant_id
     try:
         data = api_manila.default_quota_get(request, tenant_id)
     except Exception:
         data = []
         exceptions.handle(self.request,
                           _('Unable to get manila default quota.'))
     return data
Пример #2
0
 def prepare_action_context(self, request, context):
     try:
         quota_defaults = api_manila.default_quota_get(
             request, request.user.tenant_id)
         for field in api_manila.MANILA_QUOTA_FIELDS:
             context[field] = quota_defaults.get(field).limit
     except Exception:
         exceptions.handle(request,
                           _('Unable to retrieve default share quotas.'))
     return context
Пример #3
0
 def prepare_action_context(self, request, context):
     try:
         quota_defaults = api_manila.default_quota_get(
             request, request.user.tenant_id)
         for field in api_manila.MANILA_QUOTA_FIELDS:
             # Resolve mismatch UI field names and data field names.
             data_field = api_manila.MANILA_QUOTA_FIELDS_DATA_MAP[field]
             context[field] = quota_defaults.get(data_field).limit
     except Exception:
         exceptions.handle(request,
                           _('Unable to retrieve default share quotas.'))
     return context