Revision a989b48e snf-astakos-app/astakos/im/endpoints/qh.py

b/snf-astakos-app/astakos/im/endpoints/qh.py
228 228
        export_limit = q1.export_limit + q2.export_limit)
229 229

  
230 230

  
231
def qh_register_user_with_quotas(user):
232
    return register_users_with_quotas([user])
233

  
234

  
235
def register_users_with_quotas(users):
236
    rejected = register_users(users)
237
    if not rejected:
238
        register_quotas(users)
239

  
240

  
241 231
def register_users(users):
242 232
    if not users:
243 233
        return
......
250 240
    return create_entity(payload)
251 241

  
252 242

  
253
def register_quotas(users):
254
    if not users:
243
def register_quotas(quotas):
244
    if not quotas:
255 245
        return
256 246

  
257 247
    payload = []
258 248
    append = payload.append
259
    for u in users:
260
        for resource, q in u.all_quotas().iteritems():
249
    for uuid, userquotas in quotas.iteritems():
250
        for resource, q in userquotas.iteritems():
261 251
            append(SetQuotaPayload(
262
                    holder=u.uuid,
252
                    holder=uuid,
263 253
                    resource=resource,
264 254
                    key=ENTITY_KEY,
265 255
                    quantity=q.quantity,

Also available in: Unified diff