Commit 75a86107 authored by Bartek Górny's avatar Bartek Górny

Searchable Text stored in a dedicated selection.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12575 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9edeb7a6
......@@ -60,7 +60,18 @@ def getAttrFromFilename(self, fname):
return {}
return m.groupdict()
def ofof(one, another):
return one.__of__(another)
def getLastWorkflowDate(self, state_name='simulation_state', state=('released','public')):
'''we can make something more generic out of it
or JP says "there is an API for it" and we trash this one'''
for name,wflow in self.workflow_history.items():
if len(wflow) == 0: continue # empty history
if wflow[0].get(state_name) is None: continue # not the right one
for i in range(len(wflow)):
ch = wflow[-1-i]
act = ch.get('action', '')
if act is not None and act.endswith('action'):
if ch.get(state_name, '') in state:
return ch['time']
return 0
# vim: syntax=python shiftwidth=2
......@@ -74,7 +74,7 @@
The main search script. Receives one big string - a SearchableText, in\n
the search syntax, parses the string using external method parseSearchString,\n
then does the following:\n
- processes arguments for searching by any category (this requires SQLCatalog patch)\n
- processes arguments for searching by any category\n
- selects search mode\n
- adds creation and modification date clauses\n
- searches\n
......@@ -90,9 +90,14 @@ TODO: use catalog to get only the user\'s docs - this implementation is slow.\n
# SearchableText can be supplied in request or stored in selection\n
sstr = context.REQUEST.get(\'SearchableText\')\n
\n
if not sstr:\n
sstr = kw.get(\'SearchableText\')\n
if sstr:\n
context.portal_selections.setSelectionParamsFor(\'search_params_selection\', dict(SearchableText=sstr))\n
else:\n
params = context.portal_selections.getSelectionParamsFor(\'search_params_selection\')\n
if params:\n
sstr = params.get(\'SearchableText\')\n
\n
context.log(sstr)\n
if not sstr: return []\n
\n
args = context.parseSearchString(sstr)\n
......@@ -233,6 +238,8 @@ return res\n
<string>_getattr_</string>
<string>context</string>
<string>sstr</string>
<string>dict</string>
<string>params</string>
<string>args</string>
<string>_getitem_</string>
<string>_write_</string>
......@@ -243,7 +250,6 @@ return res\n
<string>v</string>
<string>mode</string>
<string>modemap</string>
<string>dict</string>
<string>cf</string>
<string>ct</string>
<string>mf</string>
......
......@@ -91,7 +91,11 @@ except AttributeError:\n
txt = \'\'\n
\n
argument_names = (\'SearchableText\', \'SearchableText_any\', \'SearchableText_all\', \'SearchableText_phrase\')\n
search_string = \' \'.join(selection.params.get(name, \'\') for name in argument_names)\n
\n
# a quick hack because sometimes we get a list\n
params = [selection.params.get(name, \'\') for name in argument_names]\n
params = [(hasattr(par, \'sort\') and \'\'.join(par) or par) for par in params]\n
search_string = \' \'.join(params)\n
\n
if not search_string:\n
# if the searched text is empty (e.g. because the listbox uses its own method)\n
......@@ -161,6 +165,13 @@ return \' \'.join(map(str, res))\n
<string>txt</string>
<string>AttributeError</string>
<string>argument_names</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>name</string>
<string>params</string>
<string>par</string>
<string>hasattr</string>
<string>search_string</string>
<string>_getitem_</string>
<string>context</string>
......
502
\ No newline at end of file
503
\ 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