Revision 08043775
b/snf-astakos-app/astakos/api/quotas.py | ||
---|---|---|
45 | 45 |
from astakos.im.api.user import user_from_token |
46 | 46 |
from astakos.im.api.service import service_from_token |
47 | 47 |
|
48 |
from astakos.im.quotas import (get_user_quotas, get_resources,
|
|
49 |
get_service_quotas)
|
|
48 |
from astakos.im.resources import get_resources
|
|
49 |
from astakos.im.quotas import get_user_quotas, get_service_quotas
|
|
50 | 50 |
|
51 | 51 |
import astakos.quotaholder.exception as qh_exception |
52 | 52 |
from astakos.quotaholder.callpoint import QuotaholderDjangoDBCallpoint |
b/snf-astakos-app/astakos/im/quotas.py | ||
---|---|---|
107 | 107 |
qh.set_holder_quota(quotas) |
108 | 108 |
|
109 | 109 |
|
110 |
def get_resources(resources=None, services=None): |
|
111 |
if resources is None: |
|
112 |
rs = Resource.objects.all() |
|
113 |
else: |
|
114 |
rs = Resource.objects.filter(name__in=resources) |
|
115 |
|
|
116 |
if services is not None: |
|
117 |
rs = rs.filter(service__in=services) |
|
118 |
|
|
119 |
resource_dict = {} |
|
120 |
for r in rs: |
|
121 |
resource_dict[r.full_name()] = r.get_info() |
|
122 |
|
|
123 |
return resource_dict |
|
124 |
|
|
125 |
|
|
126 | 110 |
def get_default_quota(): |
127 | 111 |
_DEFAULT_QUOTA = {} |
128 | 112 |
resources = Resource.objects.select_related('service').all() |
b/snf-astakos-app/astakos/im/resources.py | ||
---|---|---|
82 | 82 |
diff = uplimit - old_uplimit |
83 | 83 |
if diff != 0: |
84 | 84 |
qh_add_resource_limit(r, diff) |
85 |
|
|
86 |
|
|
87 |
def get_resources(resources=None, services=None): |
|
88 |
if resources is None: |
|
89 |
rs = Resource.objects.all() |
|
90 |
else: |
|
91 |
rs = Resource.objects.filter(name__in=resources) |
|
92 |
|
|
93 |
if services is not None: |
|
94 |
rs = rs.filter(service__in=services) |
|
95 |
|
|
96 |
resource_dict = {} |
|
97 |
for r in rs: |
|
98 |
resource_dict[r.full_name()] = r.get_info() |
|
99 |
|
|
100 |
return resource_dict |
Also available in: Unified diff