Commit 13f2e816 authored by Ivan Tyagov's avatar Ivan Tyagov

Handle case when no tag has been defined.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38975 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7602f605
...@@ -55,11 +55,9 @@ box = context.restrictedTraverse(box_relative_url)\n ...@@ -55,11 +55,9 @@ box = context.restrictedTraverse(box_relative_url)\n
preferences = box.KnowledgeBox_getDefaultPreferencesDict()\n preferences = box.KnowledgeBox_getDefaultPreferencesDict()\n
preferred_tag = preferences.get(\'preferred_tag\', None)\n preferred_tag = preferences.get(\'preferred_tag\', None)\n
if preferred_tag is not None:\n if preferred_tag is not None:\n
subject_list_from_preferences=preferred_tag.split(\' \')\n subject_list_from_preferences=[x for x in preferred_tag.split(\' \') if x!=\'\']\n
filtered_subject_list_from_preferences =[]\n if subject_list_from_preferences:\n
for x in subject_list_from_preferences:\n return context.portal_catalog(subject=["%%%s%%" %tag for tag in subject_list_from_preferences])\n
filtered_subject_list_from_preferences.append("%" + x + "%")\n
return context.portal_catalog(subject=filtered_subject_list_from_preferences)\n
return []\n return []\n
</string> </value> </string> </value>
</item> </item>
...@@ -105,10 +103,12 @@ return []\n ...@@ -105,10 +103,12 @@ return []\n
<string>box</string> <string>box</string>
<string>preferences</string> <string>preferences</string>
<string>preferred_tag</string> <string>preferred_tag</string>
<string>subject_list_from_preferences</string> <string>append</string>
<string>filtered_subject_list_from_preferences</string> <string>$append0</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>x</string> <string>x</string>
<string>subject_list_from_preferences</string>
<string>tag</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
1581 1583
\ 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