[CMF-checkins] CVS: CMF/CMFCollector/skins/collector - collector_search.py:1.9
Ken Manheimer
klm@zope.com
Thu, 25 Oct 2001 17:59:25 -0400
Update of /cvs-repository/CMF/CMFCollector/skins/collector
In directory cvs.zope.org:/tmp/cvs-serv1001
Modified Files:
collector_search.py
Log Message:
Adjust to the internal catalog, getting rid of the complicated Subject
index overloading scheme.
Also, counting on the nicely normalized security_related settings.
=== CMF/CMFCollector/skins/collector/collector_search.py 1.8 => 1.9 ===
query['sort_on'] = 'created'
query['Type'] = "Collector Issue"
-query['path'] = "/".join(context.getPhysicalPath())
reqget = context.REQUEST.get
subj_items = []
@@ -14,47 +13,36 @@
val = reqget(field, None)
if val:
query[index_name] = val
-def supplement_subject_one(field, index_name=None,
- reqget=reqget, items=subj_items):
- if not index_name: index_name = field
- val = reqget(field, None)
- if val:
- items.append('%s:%s' % (index_name, val))
-def supplement_subject_many(field, index_name=None,
- reqget=reqget, items=subj_items):
- if not index_name: index_name = field
- vals = reqget(field, [])
- for i in vals:
- items.append('%s:%s' % (index_name, i))
supplement_query("SearchableText")
supplement_query("Creator")
-supplement_subject_many("classifications", "classification")
-supplement_subject_many("severities", "severity")
-supplement_subject_many("supporters", "assigned_to")
-supplement_subject_one("resolution")
-supplement_subject_one("reported_version")
+supplement_query("classifications", "classification")
+supplement_query("severities", "severity")
+supplement_query("supporters", "assigned_to")
+supplement_query("resolution")
+supplement_query("reported_version")
sr = reqget("security_related", [])
-
if sr:
if 'Yes' in sr and 'No' in sr:
+ # Both means we don't care - don't include in query.
pass
elif 'Yes' in sr:
- subj_items.append('security_related:1')
+ query['security_related'] = [1]
else:
- subj_items.append('security_related:0')
-
-if subj_items:
- query["Subject"] = subj_items
+ query['security_related'] = [0]
rs = []
+
for i in reqget("status", []):
rs.append(i)
# Include confidential alternatives to selected states.
+ # XXX To account for changes, we should obtain all the possible states,
+ # and just do token processing according to their names.
if i in ['Pending', 'Accepted']:
rs.append("%s_confidential" % i)
if rs:
- query['review_state'] = rs
+ query['status'] = rs
-return context.portal_catalog(REQUEST=query)
+got = context.get_internal_catalog()(REQUEST=query)
+return got