Revision d2b32360 snf-astakos-app/astakos/im/endpoints/qh.py
b/snf-astakos-app/astakos/im/endpoints/qh.py | ||
---|---|---|
118 | 118 |
'import_limit', |
119 | 119 |
'export_limit')) |
120 | 120 |
|
121 |
def qh_add_quota(serial, quotalimits_list):
|
|
121 |
def qh_add_quota(serial, sub_list, add_list):
|
|
122 | 122 |
if not QUOTAHOLDER_URL: |
123 | 123 |
return () |
124 | 124 |
|
125 | 125 |
context = {} |
126 | 126 |
c = get_client() |
127 | 127 |
|
128 |
data = [] |
|
129 |
append = data.append |
|
130 |
for ql in quotalimits_list: |
|
128 |
sub_quota = [] |
|
129 |
sub_append = sub_quota.append |
|
130 |
add_quota = [] |
|
131 |
add_append = add_quota.append |
|
132 |
|
|
133 |
for ql in sub_quota: |
|
131 | 134 |
args = (ql.holder, ql.resource, ENTITY_KEY, |
132 | 135 |
0, ql.capacity, ql.import_limit, ql.export_limit) |
133 |
append(args) |
|
136 |
sub_append(args) |
|
137 |
|
|
138 |
for ql in add_quota: |
|
139 |
args = (ql.holder, ql.resource, ENTITY_KEY, |
|
140 |
0, ql.capacity, ql.import_limit, ql.export_limit) |
|
141 |
add_append(args) |
|
134 | 142 |
|
135 | 143 |
result = c.add_quota(context=context, |
136 | 144 |
clientkey=clientkey, |
137 | 145 |
serial=serial, |
138 |
add_quota=data) |
|
146 |
sub_quota=sub_quota, |
|
147 |
add_quota=add_quota) |
|
139 | 148 |
|
140 | 149 |
return result |
141 | 150 |
|
Also available in: Unified diff