Commit 44c96349 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: use portal_catalog to be complaint with listbox pagination

   Call catalog on the uids for compute properly the list of objects to list (pagination + sort).

    Remarrk: This change isn't ideal and introduce an extra catalog call, but this only adds few microseconds (>10ms) to the return.
parent 94999b09
# 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,7 @@ 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())]
return portal.portal_catalog(uid=[i.uid
for i in context.portal_simulation.getCurrentTrackingList(
node_uid=context.getUid(), at_date=DateTime())
if filter_per_portal_type(i.getObject())], **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,7 @@ 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())]
return portal.portal_catalog(uid=[i.uid
for i in context.portal_simulation.getCurrentTrackingList(
project_uid=context.getUid(), at_date=DateTime())
if filter_per_portal_type(i.getObject())], **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