Skip to content

Commit f224e83

Browse files
Merge pull request #1 from maxipavlovic/feature/LITE-13900
LITE-13900 Added support for %20 in like/ilike operator
2 parents 92baaef + b2db6aa commit f224e83

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ RQL (Resource query language) is designed for modern application development. It
1212
This is a query language fast and convenient database interaction. RQL was designed for use in URLs to request object-style data structures.
1313

1414

15+
[RQL Reference](https://connect.cloudblue.com/community/api/rql/)
16+
1517
[RQL for Web](https://www.sitepen.com/blog/resource-query-language-a-query-language-for-the-web-nosql/)
16-
[RQL Reference](https://docs.cloudblue.com/oa/8.0/sdk/api/rest/rql/index.html)
1718

1819
Notes
1920
-----
@@ -193,7 +194,7 @@ Development
193194
Testing
194195
=======
195196

196-
1. Python 3.5+
197+
1. Python 3.6+
197198
0. Install dependencies `requirements/test.txt`
198199
0. `export PYTHONPATH=/your/path/to/django-rql/`
199200

dj_rql/grammar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
| /'[^']*'/
8686
UNQUOTED_VAL: NULL
8787
| EMPTY
88-
| /[\w\-\*\+\\]/ /[\w\.\-\:\+\@\*\\]/*
88+
| /[\w\-\*\+\\]/ /[\w\.\s\-\:\+\@\*\\]/*
8989
9090
EMPTY: "empty()"
9191
NULL: "null()"

dj_rql/transformer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ def select(self, args):
155155

156156
if props:
157157
for prop in props:
158-
self._filtered_props.add(prop.replace('-', '').replace('+', ''))
158+
if not prop.startswith('-'):
159+
self._filtered_props.add(prop.replace('+', ''))
159160

160161
return Q()
161162

tests/test_drf/test_common_drf_backend.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ def test_reflecting_star_in_like(api_client, clear_cache):
2828
assert response.data == [{'id': books[0].pk}]
2929

3030

31+
@pytest.mark.django_db
32+
def test_reflecting_20_and_minus(api_client, clear_cache):
33+
books = [Book.objects.create(title='A B-c0')]
34+
response = api_client.get(reverse('book-list') + r'?like(title,*A%20 B-c0*)')
35+
assert response.status_code == HTTP_200_OK
36+
assert response.data == [{'id': books[0].pk}]
37+
38+
3139
@pytest.mark.django_db
3240
def test_list(api_client, clear_cache):
3341
books = [Book.objects.create() for _ in range(2)]

tests/test_parser/test_searching.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
search_operators = [SearchOperators.LIKE, SearchOperators.I_LIKE]
1515

1616
SEARCH_OKAY_VALUES = OK_VALUES[:]
17-
SEARCH_OKAY_VALUES.extend(['*v', 'v*', '*v*', '*v*v', '*v*v*', '"*v v*"'])
17+
SEARCH_OKAY_VALUES.extend(['*v', 'v*', '*v*', '*v*v', '*v*v*', '"*v v*"', 'v v'])
1818

1919

2020
def search_transform(operator, prop, value):

0 commit comments

Comments
 (0)