Revision eee9ec4d snf-astakos-app/astakos/im/models.py

b/snf-astakos-app/astakos/im/models.py
1479 1479
        except Project.DoesNotExist:
1480 1480
            return self.state_display()
1481 1481

  
1482
    def add_resource_policy(self, service, resource, uplimit):
1482
    def add_resource_policy(self, resource, uplimit):
1483 1483
        """Raises ObjectDoesNotExist, IntegrityError"""
1484 1484
        q = self.projectresourcegrant_set
1485 1485
        resource = Resource.objects.get(name=resource)
......
1497 1497
    def resource_policies(self):
1498 1498
        return [str(rp) for rp in self.projectresourcegrant_set.all()]
1499 1499

  
1500
    @resource_policies.setter
1501
    def resource_policies(self, policies):
1502
        for p in policies:
1503
            service = p.get('service', None)
1504
            resource = p.get('resource', None)
1505
            uplimit = p.get('uplimit', 0)
1506
            self.add_resource_policy(service, resource, uplimit)
1500
    def set_resource_policies(self, policies):
1501
        for resource, uplimit in policies:
1502
            self.add_resource_policy(resource, uplimit)
1507 1503

  
1508 1504
    def pending_modifications_incl_me(self):
1509 1505
        q = self.chained_applications()

Also available in: Unified diff