[CMF-checkins] CVS: CMF/CMFDefault/skins/generic - doFormSearch.py:1.2.18.2
Florent Guillaume
fg@nuxeo.com
Sat, 3 Aug 2002 14:06:56 -0400
Update of /cvs-repository/CMF/CMFDefault/skins/generic
In directory cvs.zope.org:/tmp/cvs-serv13947
Modified Files:
Tag: CMF-1_3-branch
doFormSearch.py
Log Message:
Merged change from HEAD:
Improved search speed in the standard cases by not passing a 'created'
argument when searching for documents without a creation date constraint.
=== CMF/CMFDefault/skins/generic/doFormSearch.py 1.2.18.1 => 1.2.18.2 ===
##parameters=REQUEST
##title=Pre-process form variables, then return catalog query results.
##
+vars = REQUEST.form
form_vars = {}
+skip_vars = []
select_vars = ( 'review_state'
, 'Subject'
, 'portal_type'
)
+date_vars = ('created',
+ )
+epoch = DateTime("1970/01/01 00:00:00 GMT")
-for k, v in REQUEST.form.items():
+for k, v in vars.items():
if k in select_vars:
-
if same_type( v, [] ):
v = filter( None, v )
if not v:
continue
+ if k in date_vars:
+ if v == epoch and vars.get(k+'_usage') == 'range:min':
+ skip_vars.append(k+'_usage')
+ continue
+
form_vars[ k ] = v
+
+for k in skip_vars:
+ del form_vars[k]
return context.portal_catalog( form_vars )