Skip to content

Commit 3787631

Browse files
committed
[FIX] base/17.0: do not adapt invalid domains
We handle the most common cases and as a last resort we call convert_domain_leaf() in order to convert a domain to a valid Python expression. If that fails, we may confidently state that the given domain is invalid, thus we skip its adaptation altogether. closes #77 Signed-off-by: Christophe Simonis (chs) <[email protected]>
1 parent 620c921 commit 3787631

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/base/17.0.1.3/attr_domains2expr.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,10 @@ def convert_attrs_val(cr, model, field_path, val):
491491
op = {"&": "and", "|": "or"}[item]
492492
stack.append(f"({left} {op} {right})")
493493
else:
494-
stack.append(convert_domain_leaf(cr, model, field_path, item))
494+
try:
495+
stack.append(convert_domain_leaf(cr, model, field_path, item))
496+
except Exception:
497+
raise InvalidDomainError(ast.unparse(orig_ast)) from None
495498
assert len(stack) == 1
496499
res = stack.pop()
497500
assert res[0] == "(" and res[-1] == ")", res

0 commit comments

Comments
 (0)