changeset 0fc707f9cecd in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset&node=0fc707f9cecd
description:
Allow PYSON Expression as key for PYSON In with dict object
issue10542
diffstat:
CHANGELOG | 1 +
tryton/pyson.py | 10 ++++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diffs (31 lines):
diff -r 6a1a1ce938cb -r 0fc707f9cecd CHANGELOG
--- a/CHANGELOG Sun Jul 04 17:54:49 2021 +0200
+++ b/CHANGELOG Sun Jul 11 11:25:30 2021 +0200
@@ -1,3 +1,4 @@
+* Allow PYSON Expression as key for PYSON In with dict object
* Support Binary field in CSV import/export
Version 6.0.0 - 2021-05-03
diff -r 6a1a1ce938cb -r 0fc707f9cecd tryton/pyson.py
--- a/tryton/pyson.py Sun Jul 04 17:54:49 2021 +0200
+++ b/tryton/pyson.py Sun Jul 11 11:25:30 2021 +0200
@@ -485,11 +485,17 @@
assert obj.types().issubset({dict, list}), \
'obj must be a dict or a list'
if obj.types() == {dict}:
- assert isinstance(key, str), 'key must be a string'
+ if isinstance(key, PYSON):
+ assert key.types() == {str}, 'key must be a string'
+ else:
+ assert isinstance(key, str), 'key must be a string'
else:
assert isinstance(obj, (dict, list))
if isinstance(obj, dict):
- assert isinstance(key, str), 'key must be a string'
+ if isinstance(key, PYSON):
+ assert key.types() == {str}, 'key must be a string'
+ else:
+ assert isinstance(key, str), 'key must be a string'
self._key = key
self._obj = obj