storage: always convert dictionaries bytes (#39318)

This commit is contained in:
Frédéric Péters 2020-01-28 10:26:45 +01:00
parent aa2e475fd7
commit 7a663969bf
1 changed files with 3 additions and 3 deletions

View File

@ -122,14 +122,14 @@ def deep_bytes2str(obj, seen=None):
return obj
if isinstance(obj, list):
return [deep_bytes2str(x, seen) for x in obj]
if id(obj) in seen:
return obj
seen[id(obj)] = True
if isinstance(obj, dict):
new_d = {}
for k, v in obj.items():
new_d[force_str(k)] = deep_bytes2str(v, seen)
return new_d
if id(obj) in seen:
return obj
seen[id(obj)] = True
if hasattr(obj, '__class__') and obj.__class__.__module__.startswith(('wcs.', 'qommon.', 'modules.')):
obj.__dict__ = deep_bytes2str(obj.__dict__, seen)
return obj