update
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user