Commit f68aed44 authored by Jérome Perrin's avatar Jérome Perrin

administration: fix catalog table scan in Item_checkTrackingList

This fix a regression from 920655a2 : when item has no tracking, uid was
passed an empty list and this fetched all catalog.
Also call getObject explicitly only once instead of having it called
implicitly twice.
parent c219c40a
......@@ -2,16 +2,17 @@ from Products.CMFActivity.ActiveResult import ActiveResult
portal = context.getPortalObject()
tracking_list = list(reversed(portal.portal_simulation.getCurrentTrackingList(aggregate_uid=context.getUid())))
delivery_dict = {
x.uid: x
for x in portal.portal_catalog(
uid=[x.delivery_uid for x in tracking_list],
)
}
for previous_brain, next_brain in zip(tracking_list, tracking_list[1:]):
if delivery_dict[previous_brain.delivery_uid].getDestination() != delivery_dict[next_brain.delivery_uid].getSource():
portal.restrictedTraverse(active_process).postResult(
ActiveResult(summary=script.getId(),
detail='%s has tracking error' % context.getRelativeUrl(),
result='',
severity=100))
if tracking_list:
delivery_dict = {
x.uid: x.getObject()
for x in portal.portal_catalog(
uid=[x.delivery_uid for x in tracking_list],
)
}
for previous_brain, next_brain in zip(tracking_list, tracking_list[1:]):
if delivery_dict[previous_brain.delivery_uid].getDestination() != delivery_dict[next_brain.delivery_uid].getSource():
portal.restrictedTraverse(active_process).postResult(
ActiveResult(summary=script.getId(),
detail='%s has tracking error' % context.getRelativeUrl(),
result='',
severity=100))
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