Revision 9ee0c6a2

b/snf-astakos-app/astakos/im/models.py
73 73

  
74 74
RESOURCE_SEPARATOR = '.'
75 75

  
76
inf = float('inf')
76 77

  
77 78
class Service(models.Model):
78 79
    name = models.CharField('Name', max_length=255, unique=True, db_index=True)
......
250 251
    def quota(self):
251 252
        d = defaultdict(int)
252 253
        for q in self.astakosgroupquota_set.select_related().all():
253
            d[q.resource] += q.uplimit
254
            d[q.resource] += q.uplimit or inf
254 255
        return d
255 256
    
256 257
    def add_policy(self, service, resource, uplimit, update=True):
......
407 408
        """Returns a dict with the sum of quota limits per resource"""
408 409
        d = defaultdict(int)
409 410
        for q in self.policies:
410
            d[q.resource] += q.uplimit
411
            d[q.resource] += q.uplimit or inf
411 412
        for m in self.extended_groups:
412 413
            if not m.is_approved:
413 414
                continue
......
415 416
            if not g.is_enabled:
416 417
                continue
417 418
            for r, uplimit in g.quota.iteritems():
418
                d[r] += uplimit
419

  
419
                d[r] += uplimit or inf
420 420
        # TODO set default for remaining
421 421
        return d
422 422

  

Also available in: Unified diff