Revision 14a58548 snf-astakos-app/astakos/im/models.py

b/snf-astakos-app/astakos/im/models.py
259 259
    return QuotaValues(
260 260
        quantity = 0,
261 261
        capacity = capacity,
262
        import_limit = QH_PRACTICALLY_INFINITE,
263
        export_limit = QH_PRACTICALLY_INFINITE)
262
        )
264 263

  
265 264
def get_default_quota():
266 265
    _DEFAULT_QUOTA = {}
......
460 459
            p.setdefault('resource', '')
461 460
            p.setdefault('capacity', 0)
462 461
            p.setdefault('quantity', 0)
463
            p.setdefault('import_limit', 0)
464
            p.setdefault('export_limit', 0)
465 462
            p.setdefault('update', True)
466 463
            self.add_resource_policy(**p)
467 464

  
468 465
    def add_resource_policy(
469
            self, resource, capacity, quantity, import_limit,
470
            export_limit, update=True):
466
            self, resource, capacity, quantity,
467
            update=True):
471 468
        """Raises ObjectDoesNotExist, IntegrityError"""
472 469
        s, sep, r = resource.partition(RESOURCE_SEPARATOR)
473 470
        resource = Resource.objects.get(service__name=s, name=r)
......
476 473
                user=self, resource=resource, defaults={
477 474
                    'capacity':capacity,
478 475
                    'quantity': quantity,
479
                    'import_limit':import_limit,
480
                    'export_limit':export_limit})
476
                    })
481 477
        else:
482 478
            q = self.astakosuserquota_set
483 479
            q.create(
484 480
                resource=resource, capacity=capacity, quanity=quantity,
485
                import_limit=import_limit, export_limit=export_limit)
481
                )
486 482

  
487 483
    def get_resource_policy(self, resource):
488 484
        s, sep, r = resource.partition(RESOURCE_SEPARATOR)
......
1066 1062
        return QuotaValues(
1067 1063
            quantity = self.quantity,
1068 1064
            capacity = self.capacity,
1069
            import_limit = self.import_limit,
1070
            export_limit = self.export_limit)
1065
            )
1071 1066

  
1072 1067

  
1073 1068
class ApprovalTerms(models.Model):
......
1792 1787
        return QuotaValues(
1793 1788
            quantity = 0,
1794 1789
            capacity = self.member_capacity,
1795
            import_limit = self.member_import_limit,
1796
            export_limit = self.member_export_limit)
1790
            )
1797 1791

  
1798 1792
    def display_member_capacity(self):
1799 1793
        if self.member_capacity:
......
2295 2289
                               holder       = holder,
2296 2290
                               resource     = str(grant.resource),
2297 2291
                               capacity     = grant.member_capacity,
2298
                               import_limit = grant.member_import_limit,
2299
                               export_limit = grant.member_export_limit))
2292
                               ))
2300 2293

  
2301 2294
        pending_application = self.pending_application
2302 2295
        if pending_application is not None:
......
2306 2299
                               holder       = holder,
2307 2300
                               resource     = str(new_grant.resource),
2308 2301
                               capacity     = new_grant.member_capacity,
2309
                               import_limit = new_grant.member_import_limit,
2310
                               export_limit = new_grant.member_export_limit))
2302
                               ))
2311 2303

  
2312 2304
        return (sub_list, add_list)
2313 2305

  

Also available in: Unified diff