Commit 920655a2 authored by Vincent Pelletier's avatar Vincent Pelletier

erp5_administration: Stop using getObject.

Also, why make only 2 queries when I can make 2n+1 queries for the same
result ?
parent da7e0f0b
......@@ -2,12 +2,14 @@ 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:]):
previous_delivery = portal.portal_catalog.getObject(previous_brain.delivery_uid)
next_delivery = portal.portal_catalog.getObject(next_brain.delivery_uid)
if previous_delivery.getDestination() != next_delivery.getSource():
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(),
......
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