Commit 3e24eee3 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

astakos: Move get_resources in resources.py

parent 95f722a1
......@@ -45,8 +45,8 @@ from astakos.im.api import api_method as generic_api_method
from astakos.im.api.user import user_from_token
from astakos.im.api.service import service_from_token
from astakos.im.quotas import (get_user_quotas, get_resources,
get_service_quotas)
from astakos.im.resources import get_resources
from astakos.im.quotas import get_user_quotas, get_service_quotas
import astakos.quotaholder.exception as qh_exception
from astakos.quotaholder.callpoint import QuotaholderDjangoDBCallpoint
......
......@@ -107,22 +107,6 @@ def set_user_quota(quotas):
qh.set_holder_quota(quotas)
def get_resources(resources=None, services=None):
if resources is None:
rs = Resource.objects.all()
else:
rs = Resource.objects.filter(name__in=resources)
if services is not None:
rs = rs.filter(service__in=services)
resource_dict = {}
for r in rs:
resource_dict[r.full_name()] = r.get_info()
return resource_dict
def get_default_quota():
_DEFAULT_QUOTA = {}
resources = Resource.objects.select_related('service').all()
......
......@@ -82,3 +82,19 @@ def update_resource(name, uplimit):
diff = uplimit - old_uplimit
if diff != 0:
qh_add_resource_limit(r, diff)
def get_resources(resources=None, services=None):
if resources is None:
rs = Resource.objects.all()
else:
rs = Resource.objects.filter(name__in=resources)
if services is not None:
rs = rs.filter(service__in=services)
resource_dict = {}
for r in rs:
resource_dict[r.full_name()] = r.get_info()
return resource_dict
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment