Projet

Général

Profil

0001-storage-handle-tuple-likes-in-deep_bytes2str.patch

Benjamin Dauvergne, 23 janvier 2020 14:34

Télécharger (1,02 ko)

Voir les différences:

Subject: [PATCH 01/10] 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 | 4 ++++
 1 file changed, 4 insertions(+)
wcs/qommon/storage.py
122 122
            return obj
123 123
    if isinstance(obj, list):
124 124
        return [deep_bytes2str(x, seen) for x in obj]
125
    if type(obj) is tuple:  # real tuple
126
        return type(obj)(deep_bytes2str(x, seen) for x in obj)
127
    elif isinstance(obj, tuple) and hasattr(type(obj), '_replace'):  # namedtuple
128
        return type(obj)(*[deep_bytes2str(x, seen) for x in obj])
125 129
    if id(obj) in seen:
126 130
        return obj
127 131
    seen[id(obj)] = True
128
-