Commit 9d92f7e9 authored by Romain Courteaud's avatar Romain Courteaud

Only calls listFolderContents in the context of a Preference (to delete Template).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28566 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6050ddee
......@@ -53,23 +53,19 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
result = context.portal_catalog(**kw)\n
\n
if len(result)>0:\n
<value> <string># XXX This is a hack which allow to delete non indexed Template\n
# Never call listFolderContents in a place where there could be million of\n
# documents!\n
if context.getPortalType() == \'Preference\':\n
result = []\n
uid_list = kw.get(\'uid\', [])\n
for i in context.listFolderContents():\n
if i.getUid() in uid_list:\n
result.append(i)\n
return result\n
\n
result = []\n
uid_list = kw.get(\'uid\', [])\n
for i in context.listFolderContents():\n
if i.getUid() in uid_list:\n
result.append(i)\n
\n
return result\n
]]></string> </value>
else:\n
return context.portal_catalog(**kw)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
......@@ -106,14 +102,13 @@ return result\n
<value>
<tuple>
<string>kw</string>
<string>_apply_</string>
<string>_getattr_</string>
<string>context</string>
<string>result</string>
<string>len</string>
<string>uid_list</string>
<string>_getiter_</string>
<string>i</string>
<string>_apply_</string>
</tuple>
</value>
</item>
......
1283
\ No newline at end of file
1284
\ No newline at end of file
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