[Zope-Checkins] SVN: Zope/trunk/src/Products/ZCatalog/ Deprecate mixed dict/keyword argument searchResults calls and using a request object.
Hanno Schlichting
hannosch at hannosch.eu
Sun Aug 1 13:17:44 EDT 2010
Log message for revision 115344:
Deprecate mixed dict/keyword argument searchResults calls and using a request object.
Changed:
U Zope/trunk/src/Products/ZCatalog/Catalog.py
U Zope/trunk/src/Products/ZCatalog/tests/test_catalog.py
-=-
Modified: Zope/trunk/src/Products/ZCatalog/Catalog.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/Catalog.py 2010-08-01 17:15:43 UTC (rev 115343)
+++ Zope/trunk/src/Products/ZCatalog/Catalog.py 2010-08-01 17:17:42 UTC (rev 115344)
@@ -452,8 +452,14 @@
else:
real_req = request
- if real_req is not None:
- # TODO: This deserves depreaction
+ if real_req:
+ warnings.warn('You have specified a query using either a request '
+ 'object or a mixture of a query dict and keyword '
+ 'arguments. Please use only a simple query dict. '
+ 'Your query contained "%s". This support is '
+ 'deprecated and will be removed in Zope 2.14.' %
+ repr(real_req), DeprecationWarning, stacklevel=4)
+
known_keys = query.keys()
# The request has too many places where an index restriction
# might be specified. Putting all of request.form,
Modified: Zope/trunk/src/Products/ZCatalog/tests/test_catalog.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/tests/test_catalog.py 2010-08-01 17:15:43 UTC (rev 115343)
+++ Zope/trunk/src/Products/ZCatalog/tests/test_catalog.py 2010-08-01 17:17:42 UTC (rev 115344)
@@ -283,7 +283,6 @@
# getMetadataForRID
# getIndexDataForRID
# make_query
- # _sorted_search_indexes
def test_sorted_search_indexes_empty(self):
result = self._catalog._sorted_search_indexes({})
@@ -586,8 +585,8 @@
def testLimitSort(self):
from Products.ZCatalog.Catalog import mergeResults
results = [cat.searchResults(
- dict(att1='att1', number=True, sort_on='num'),
- sort_limit=2, _merge=0)
+ dict(att1='att1', number=True, sort_on='num',
+ sort_limit=2), _merge=0)
for cat in self.catalogs]
merged_rids = [r.getRID() for r in mergeResults(
results, has_sort_keys=True, reverse=False)]
More information about the Zope-Checkins
mailing list