diff options
Diffstat (limited to 'ishtar_common/views_item.py')
-rw-r--r-- | ishtar_common/views_item.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py index d2e66ae69..a818c2719 100644 --- a/ishtar_common/views_item.py +++ b/ishtar_common/views_item.py @@ -295,15 +295,21 @@ def _parse_parentheses(s): groups = [] depth = 0 + inside_quote = False for char in s: - if char == u'(': - _push_to_list([], groups, depth) - depth += 1 - elif char == ')': - if depth > 0: - depth -= 1 - else: - _push_to_list(char, groups, depth) + if char == u'"': + inside_quote = not inside_quote + if not inside_quote: + if char == u'(': + _push_to_list([], groups, depth) + depth += 1 + elif char == u')': + if depth > 0: + depth -= 1 + else: + _push_to_list(char, groups, depth) + continue + _push_to_list(char, groups, depth) # for non tolerant to parentheses mismatch check depth is equal to 0 return groups @@ -643,7 +649,6 @@ def _contruct_query(relation_types, dct, or_reqs, and_reqs): # manage multi value not already managed for key in dct.keys(): if ";" in dct[key]: - print(key, dct[key]) values = [v for v in dct[key].split(u';') if v] if not values: dct.pop(key) @@ -958,6 +963,7 @@ def get_item(model, func_name, default_name, extra_request_keys=[], dct = {upper_key: current} query &= Q(**dct) + # print(query) items = model.objects.filter(query) if exc_query: items = items.exclude(exc_query) |