Commit a1840ca7 authored by Bartek Górny's avatar Bartek Górny

In found text, if no search string was given, show text content (not...

In found text, if no search string was given, show text content (not searchable text). Looks much cleaner.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12484 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7dbf6e0d
...@@ -85,12 +85,16 @@ trail = 5\n ...@@ -85,12 +85,16 @@ trail = 5\n
# maximum lines to show\n # maximum lines to show\n
maxlines = 5\n maxlines = 5\n
\n \n
txt = brain.getObject().SearchableText()\n try:\n
txt = brain.getObject().getTextContent() or \'\'\n
except AttributeError:\n
txt = \'\'\n
\n
search_string = selection.params.get(\'SearchableText\')\n search_string = selection.params.get(\'SearchableText\')\n
if search_string is None:\n if search_string is None:\n
# if the searched text is empty (e.g. because the listbox uses its own method)\n # if the searched text is empty (e.g. because the listbox uses its own method)\n
# we return something\n # we return something\n
return txt[min(len(txt) - 300, 200) : 500] # a somewhat arbitrary choice to trim searchable attrs\n return txt[:300]\n
\n \n
search_argument_list = context.parseSearchString(search_string)\n search_argument_list = context.parseSearchString(search_string)\n
search_words = search_argument_list.get(\'SearchableText\')\n search_words = search_argument_list.get(\'SearchableText\')\n
...@@ -152,14 +156,15 @@ return \' \'.join(map(str, res))\n ...@@ -152,14 +156,15 @@ return \' \'.join(map(str, res))\n
<string>maxlines</string> <string>maxlines</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>txt</string> <string>txt</string>
<string>AttributeError</string>
<string>search_string</string> <string>search_string</string>
<string>None</string> <string>None</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>min</string>
<string>len</string>
<string>context</string> <string>context</string>
<string>search_argument_list</string> <string>search_argument_list</string>
<string>search_words</string> <string>search_words</string>
<string>min</string>
<string>len</string>
<string>res</string> <string>res</string>
<string>map</string> <string>map</string>
<string>str</string> <string>str</string>
......
471 473
\ 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