[FIX] expression: ensure tuple to compare leaf with TRUE/FALSE leaf

When setting a custom filter with as domain
[(0, '=', 1)]

the domain was rejected, because (0, '=', 1) wasn't
considered as a valid leaf, while it is.

This is because the Javascript converts this domain
using list instead of tuple
[(0, '=', 1)] -> [[0, '=', 1]]

And therefore, comparing the "list" leaf
to the TRUE/FALSE leaf tuple failed.

Ensuring "element" as a tuple solves the issue.

opw-640306
This commit is contained in:
Denis Ledoux 2015-05-20 15:33:10 +02:00
parent cc61d467fa
commit 54a90179bb
1 changed files with 1 additions and 1 deletions

View File

@ -401,7 +401,7 @@ def is_leaf(element, internal=False):
and len(element) == 3 \
and element[1] in INTERNAL_OPS \
and ((isinstance(element[0], basestring) and element[0])
or element in (TRUE_LEAF, FALSE_LEAF))
or tuple(element) in (TRUE_LEAF, FALSE_LEAF))
# --------------------------------------------------