This commit is contained in:
2025-07-09 13:44:39 -03:00
parent 690be35634
commit 72b1338135
7 changed files with 66 additions and 27 deletions

View File

@@ -1,4 +1,5 @@
import re
import urllib.parse as urllib
OPERATORS = [
'!=',
@@ -41,7 +42,7 @@ def parse_condition(condition: str) -> dict[str, str] | None:
def parse(s: str) -> list[dict]:
filter_expr = re.sub(r'\s+', ' ', s).strip()
filter_expr = re.sub(r'\s+', ' ', urllib.unquote(s)).strip()
if filter_expr == '':
return []
@@ -59,4 +60,4 @@ def parse(s: str) -> list[dict]:
def encode(conditions: list[dict]):
return ' AND '.join(f'{c["attr"]} {c["op"]} {c["value"]}' for c in conditions if c)
return ' AND '.join(' '.join(c.values()).strip() for c in conditions if c)