From 999057ba40722f9ca1ca25015e319d0327685944 Mon Sep 17 00:00:00 2001 From: Daniel Ancuta Date: Sat, 3 Mar 2018 23:29:29 +0000 Subject: [PATCH 1/2] PYCBC-472: Evaluate/merge PR: "TypeError: _assign_kwargs() got an unexpected keyword argument 'distance'" As per title: At the moment when you try to use `GeoDistanceQuery` you will get: ```sh Traceback (most recent call last): File "test.py", line 208, in for city in cities: File "test.py", line 103, in get_by_coordinates GeoDistanceQuery('1km', (lon, lat)), File "/my-path/venv/lib/python3.6/site-packages/couchbase/fulltext.py", line 697, in __init__ _assign_kwargs(self, **kwargs) TypeError: _assign_kwargs() got an unexpected keyword argument 'distance' ``` That fixes this problem. Change-Id: Ic1e2a0dedba9bfd53d749dba6507442f6abbaf52 Reviewed-on: http://review.couchbase.org/90858 Tested-by: Build Bot Reviewed-by: Ellis Breen Reviewed-by: Mike Goldsmith Reviewed-on: http://review.couchbase.org/93439 --- couchbase/fulltext.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/couchbase/fulltext.py b/couchbase/fulltext.py index ea85795be..92bae85a9 100644 --- a/couchbase/fulltext.py +++ b/couchbase/fulltext.py @@ -694,7 +694,7 @@ def __init__(self, distance, location, **kwargs): super(GeoDistanceQuery, self).__init__() kwargs['distance'] = distance kwargs['location'] = location - _assign_kwargs(self, **kwargs) + _assign_kwargs(self, kwargs) location = _genprop(_location_conv, 'location', doc='Location') distance = _genprop_str('distance') @@ -706,7 +706,7 @@ def __init__(self, top_left, bottom_right, **kwargs): super(GeoBoundingBoxQuery, self).__init__() kwargs['top_left'] = top_left kwargs['bottom_right'] = bottom_right - _assign_kwargs(self, **kwargs) + _assign_kwargs(self, kwargs) top_left = _genprop( _location_conv, 'top_left', From 8216ec7270e1fe8a6ff6016f869f0c03475107d6 Mon Sep 17 00:00:00 2001 From: Dave Starling Date: Thu, 12 Apr 2018 15:29:16 +0100 Subject: [PATCH 2/2] PYCBC-477: Update PrefixQuery to allow unicode characters Updated PrefixQuery to use _genprop_str so that unicode characters do not raise an unnecessary conversion exception. Change-Id: I22d7265ee36d35545fbe7bf1c6d5339ea980ba0d Reviewed-on: http://review.couchbase.org/92632 Reviewed-by: Ellis Breen Reviewed-by: Mike Goldsmith Tested-by: Build Bot Reviewed-on: http://review.couchbase.org/93440 --- couchbase/fulltext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchbase/fulltext.py b/couchbase/fulltext.py index 92bae85a9..794ababe6 100644 --- a/couchbase/fulltext.py +++ b/couchbase/fulltext.py @@ -668,7 +668,7 @@ class PrefixQuery(_SingleQuery): most useful for type-ahead or lookup queries. """ _TERMPROP = 'prefix' - prefix = _genprop(str, 'prefix', doc='The prefix to match') + prefix = _genprop_str('prefix', doc='The prefix to match') @_with_fields('field')