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

core: prevent calling catalog with an empty list

Folder_getDeleteObjectList could do an extra paranaoïa check that the
caller did not pass an empty list of uids, because this would cause the
script to iterate on the full catalog table.
parent 7ac21fb5
Pipeline #7176 failed with stage
in 0 seconds
......@@ -10,6 +10,6 @@ if context.getPortalType() == 'Preference':
return result
else:
# kw can contain limit, sort_on and similar runtime information
object_list = [x.getObject() for x in context.portal_catalog(uid=uid, **kw)]
object_list = [x.getObject() for x in context.portal_catalog(uid=uid or -1, **kw)]
# only docs WITHOUT relations can be deleted
return [x for x in object_list if x.getRelationCountForDeletion() == 0]
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