Commit b27d537e authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: use portal_catalog to be complaint with listbox pagination

See merge request nexedi/slapos.core!528
parents 74ce8553 0df7e6f4
# This script might not be efficient to a large quantities of
# Compute Nodes
from DateTime import DateTime
kw = {"node_uid": context.getUid(),
"at_date": DateTime()}
portal = context.getPortalObject()
def filter_per_portal_type(document):
if document.getPortalType() == "Compute Node" \
......@@ -17,6 +13,11 @@ def filter_per_portal_type(document):
and document.getValidationState() == "validated":
return document
return [ i.getObject()
for i in context.portal_simulation.getCurrentTrackingList(**kw)
if filter_per_portal_type(i.getObject())]
uid_list = [i.uid for i in context.portal_simulation.getCurrentTrackingList(
node_uid=context.getUid(), at_date=DateTime())
if filter_per_portal_type(i.getObject())]
if not uid_list:
return []
return portal.portal_catalog(uid=uid_list, **kw)
# This script might not be efficient to a large quantities of
# Compute Nodes
from DateTime import DateTime
kw = {"project_uid": context.getUid(),
"at_date": DateTime()}
portal = context.getPortalObject()
def filter_per_portal_type(document):
if document.getPortalType() == "Compute Node" \
......@@ -16,6 +13,11 @@ def filter_per_portal_type(document):
and document.getValidationState() == "validated":
return document
return [ i.getObject()
for i in context.portal_simulation.getCurrentTrackingList(**kw)
if filter_per_portal_type(i.getObject())]
uid_list = [i.uid for i in context.portal_simulation.getCurrentTrackingList(
project_uid=context.getUid(), at_date=DateTime())
if filter_per_portal_type(i.getObject())]
if not uid_list:
return []
return portal.portal_catalog(uid=uid_list, **kw)
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