def update_quota(self, context, quota_id, values): quota = self._find_quotas(context, {'id': quota_id}, one=True) quota.update(values) try: quota.save(self.session) except exceptions.Duplicate: raise exceptions.DuplicateQuota() return dict(quota)
def create_quota(self, context, values): quota = models.Quota() quota.update(values) try: quota.save(self.session) except exceptions.Duplicate: raise exceptions.DuplicateQuota() return dict(quota)