Commit 7173d28b authored by Fabien Morin's avatar Fabien Morin

speed up the script in case there is no tag

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39591 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 15a1f132
...@@ -67,13 +67,13 @@ request = container.REQUEST\n ...@@ -67,13 +67,13 @@ request = container.REQUEST\n
\n \n
requested_tag = request.get(\'tag\') # XXX-JPS it would be better to use subject which is the normal term in ERP5\n requested_tag = request.get(\'tag\') # XXX-JPS it would be better to use subject which is the normal term in ERP5\n
current_section = context.getWebSectionValue()\n current_section = context.getWebSectionValue()\n
result = []\n result = current_section.WebSection_getDocumentValueList(**kw)\n
for item in current_section.WebSection_getDocumentValueList(**kw): # XXX-JPS this could be way too slow\n tagged_result = []\n
if requested_tag is not None:\n if requested_tag is not None:\n
for item in result: # XXX-JPS this could be way too slow\n
if requested_tag in item.getSubjectList():\n if requested_tag in item.getSubjectList():\n
result.append(item)\n tagged_result.append(item)\n
else:\n return tagged_result\n
result.append(item)\n
\n \n
return result\n return result\n
</string> </value> </string> </value>
...@@ -119,11 +119,12 @@ return result\n ...@@ -119,11 +119,12 @@ return result\n
<string>requested_tag</string> <string>requested_tag</string>
<string>context</string> <string>context</string>
<string>current_section</string> <string>current_section</string>
<string>_apply_</string>
<string>result</string> <string>result</string>
<string>tagged_result</string>
<string>None</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>_apply_</string>
<string>item</string> <string>item</string>
<string>None</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
54 55
\ No newline at end of file \ 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