From ba0b105904fc88467b837b7144dc4f2e724d402e Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Thu, 9 Jan 2020 15:10:59 +0100 Subject: [PATCH 1/7] storage: handle tuple likes in deep_bytes2str It fixes a throws with wcs.wf.create_formdata.Mapping which is a collections.mamedtuple(). --- wcs/qommon/storage.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wcs/qommon/storage.py b/wcs/qommon/storage.py index 4c8ce59a..8bb115af 100644 --- a/wcs/qommon/storage.py +++ b/wcs/qommon/storage.py @@ -130,6 +130,8 @@ def deep_bytes2str(obj, seen=None): for k, v in obj.items(): new_d[force_str(k)] = deep_bytes2str(v, seen) return new_d + if isinstance(obj, tuple): + return obj.__class__(*[deep_bytes2str(x, seen) for x in obj]) if hasattr(obj, '__class__') and obj.__class__.__module__.startswith(('wcs.', 'qommon.', 'modules.')): obj.__dict__ = deep_bytes2str(obj.__dict__, seen) return obj -- 2.24.0