diff options
| author | Xavier Morel <xmo@odoo.com> | 2020-02-24 08:26:00 +0000 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2020-02-24 10:22:38 +0000 |
| commit | 9b00d352a9cdca9a57f68568237087ab24c71ac2 (patch) | |
| tree | a13b3e55ccc5bc8befce95064b185e6f730db9ad /odoo | |
| parent | 085c977af5a0a805305fb1fdaad1c8220277ea4b (diff) | |
[IMP] core: logging of array remoteobjects
The old path would just return e.g. `Array(2)` for an array of size 2,
which is not very useful when trying to see if an array's contents are
relevant to an issue.
Turns out arrays are serialized pretty much exactly like objects
without a subtype, just with property names being indices instead of
keys. So add a case which formats such remoteobjects as
array-literal-ish.
closes odoo/odoo#46056
X-original-commit: 6d5639024fa0f7501efe836e5571cd45bb46b123
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Diffstat (limited to 'odoo')
| -rw-r--r-- | odoo/tests/common.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/odoo/tests/common.py b/odoo/tests/common.py index 9356da405dd..2172bab1dc9 100644 --- a/odoo/tests/common.py +++ b/odoo/tests/common.py @@ -1107,23 +1107,30 @@ class ChromeBrowser(): """ attempts to make a CDT RemoteObject comprehensible """ objtype = arg['type'] - klass = arg.get('className', '') subtype = arg.get('subtype') if objtype == 'undefined': # the undefined remoteobject is literally just {type: undefined}... return 'undefined' - elif objtype != 'object' or subtype: + elif objtype != 'object' or subtype not in (None, 'array'): # value is the json representation for json object # otherwise fallback on the description which is "a string # representation of the object" e.g. the traceback for errors, the # source for functions, ... finally fallback on the entire arg mess return arg.get('value', arg.get('description', arg)) - + elif subtype == 'array': + # apparently value is *not* the JSON representation for arrays + # instead it's just Array(3) which is useless, however the preview + # properties are the same as object which is useful (just ignore the + # name which is the index) + return '[%s]' % ', '.join( + repr(p['value']) if p['type'] == 'string' else str(p['value']) + for p in arg.get('preview', {}).get('properties', []) + ) # all that's left is type=object, subtype=None aka custom or # non-standard objects, print as TypeName(param=val, ...), sadly because # of the way Odoo widgets are created they all appear as Class(...) return '%s(%s)' % ( - klass or objtype, + arg.get('className') or 'object', ', '.join( '%s=%s' % (p['name'], repr(p['value']) if p['type'] == 'string' else p['value']) for p in arg.get('preview', {}).get('properties', []) |
