Commit 8c34b8f8 authored by Andreas Jung's avatar Andreas Jung

     - Using "_usage" parameters in a ZCatalog query is deprecated and
       logged as DeprecationWarning.
parent a60814b3
...@@ -50,13 +50,13 @@ class DI_Tests(unittest.TestCase): ...@@ -50,13 +50,13 @@ class DI_Tests(unittest.TestCase):
self._index = DateIndex('date') self._index = DateIndex('date')
self._noop_req = {'bar': 123} self._noop_req = {'bar': 123}
self._request = {'date': DateTime(0)} self._request = {'date': DateTime(0)}
self._min_req = {'date': DateTime('2032-05-08 15:16:17'), self._min_req = {'date': {'query': DateTime('2032-05-08 15:16:17'),
'date_usage': 'range:min'} 'range': 'min'}}
self._max_req = {'date': DateTime('2032-05-08 15:16:17'), self._max_req = {'date': {'query': DateTime('2032-05-08 15:16:17'),
'date_usage': 'range:max'} 'range': 'max'}}
self._range_req = {'date': (DateTime('2002-05-08 15:16:17'), self._range_req = {'date': {'query':(DateTime('2002-05-08 15:16:17'),
DateTime('2062-05-08 15:16:17')), DateTime('2062-05-08 15:16:17')),
'date_usage': 'range:min:max'} 'range': 'min:max'}}
self._zero_req = {'date': 0} self._zero_req = {'date': 0}
self._none_req = {'date': None} self._none_req = {'date': None}
self._float_req = {'date': 1072742620.0} self._float_req = {'date': 1072742620.0}
......
...@@ -57,14 +57,14 @@ class TestCase( unittest.TestCase ): ...@@ -57,14 +57,14 @@ class TestCase( unittest.TestCase ):
self._noop_req = { 'bar': 123 } self._noop_req = { 'bar': 123 }
self._request = { 'foo': 'abce' } self._request = { 'foo': 'abce' }
self._min_req = { 'foo': 'abc' self._min_req = { 'foo': {'query': 'abc'
, 'foo_usage': 'range:min' , 'range': 'min'}
} }
self._max_req = { 'foo': 'abc' self._max_req = { 'foo': {'query': 'abc'
, 'foo_usage': 'range:max' , 'range': 'max' }
} }
self._range_req = { 'foo': ( 'abc', 'abcd' ) self._range_req = { 'foo': {'query': ( 'abc', 'abcd' )
, 'foo_usage': 'range:min:max' , 'range': 'min:max' }
} }
self._zero_req = { 'foo': 0 } self._zero_req = { 'foo': 0 }
self._none_req = { 'foo': None } self._none_req = { 'foo': None }
......
...@@ -11,10 +11,11 @@ ...@@ -11,10 +11,11 @@
# #
############################################################################# #############################################################################
__version__ = '$Id: util.py,v 1.11 2003/09/29 12:00:17 andreasjung Exp $' __version__ = '$Id: util.py,v 1.12 2004/01/07 16:44:30 andreasjung Exp $'
import re import re
from warnings import warn
from types import StringType,ListType,TupleType,DictType,InstanceType from types import StringType,ListType,TupleType,DictType,InstanceType
from DateTime import DateTime from DateTime import DateTime
...@@ -65,7 +66,6 @@ class parseIndexRequest: ...@@ -65,7 +66,6 @@ class parseIndexRequest:
""" """
self.id = iid self.id = iid
if not request.has_key(iid): if not request.has_key(iid):
self.keys = None self.keys = None
return return
...@@ -74,6 +74,7 @@ class parseIndexRequest: ...@@ -74,6 +74,7 @@ class parseIndexRequest:
usage_param = iid + '_usage' usage_param = iid + '_usage'
if request.has_key(usage_param): if request.has_key(usage_param):
self.usage = request[usage_param] self.usage = request[usage_param]
warn("\nZCatalog query using '%s' detected.\nUsing query parameters ending with '_usage' is deprecated.\nConsider using record-style parameters instead (see lib/python/Products/PluggableIndexes/README.txt for details)" % usage_param, DeprecationWarning)
param = request[iid] param = request[iid]
keys = None keys = None
......
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