[Zope-Checkins] SVN: Zope/trunk/ Deprecate acquiring the request inside Products.ZCatalog's searchResults method if no explicit query argument is given.
Hanno Schlichting
hannosch at hannosch.eu
Sun Jul 25 06:29:50 EDT 2010
Log message for revision 115068:
Deprecate acquiring the request inside Products.ZCatalog's searchResults method if no explicit query argument is given.
Changed:
U Zope/trunk/doc/CHANGES.rst
U Zope/trunk/src/Products/ZCatalog/Catalog.py
-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst 2010-07-25 10:11:46 UTC (rev 115067)
+++ Zope/trunk/doc/CHANGES.rst 2010-07-25 10:29:49 UTC (rev 115068)
@@ -35,6 +35,9 @@
Restructuring
+++++++++++++
+- Deprecate acquiring the request inside Products.ZCatalog's searchResults
+ method if no explicit query argument is given.
+
- Cleaned up the Products.ZCatalog search API's. The deprecated support for
using `<index id>_usage` arguments in the request has been removed. Support
for overriding operators via the `<index id>_operator` syntax has been
Modified: Zope/trunk/src/Products/ZCatalog/Catalog.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/Catalog.py 2010-07-25 10:11:46 UTC (rev 115067)
+++ Zope/trunk/src/Products/ZCatalog/Catalog.py 2010-07-25 10:29:49 UTC (rev 115068)
@@ -14,6 +14,7 @@
import types
import logging
+import warnings
from bisect import bisect
from random import randint
@@ -770,7 +771,11 @@
# The used argument is deprecated and is ignored
if REQUEST is None and not kw:
# Try to acquire request if we get no args for bw compat
- # TODO: Should be deprecated
+ warnings.warn('Calling searchResults without a query argument nor '
+ 'keyword arguments is deprecated. In Zope 2.14 the '
+ 'query will no longer be automatically taken from '
+ 'the acquired request.',
+ DeprecationWarning, stacklevel=2)
REQUEST = getattr(self, 'REQUEST', None)
args = CatalogSearchArgumentsMap(REQUEST, kw)
sort_index = self._getSortIndex(args)
More information about the Zope-Checkins
mailing list