From 7bcdac0413b48116ec20c1de1ecdcccdf14a8bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 28 Jan 2020 10:39:33 +0100 Subject: [PATCH] misc: repair dictionary attributes left as bytes (#39318) --- wcs/fields.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wcs/fields.py b/wcs/fields.py index 4de7f9db4..6856938c7 100644 --- a/wcs/fields.py +++ b/wcs/fields.py @@ -409,6 +409,16 @@ class Field(object): self.display_locations.append('listings') changed = True self.in_listing = None + if six.PY3: + # repair dictionary attributes that may have been kept as bytes in + # the initial python 2 -> 3 conversion. + from wcs.qommon.storage import deep_bytes2str + for key in ('prefill', 'data_source'): + value = getattr(self, key, None) + if not value: + continue + if b'type' in value: + setattr(self, key, deep_bytes2str(getattr(self, key))) return changed def evaluate_condition(self, dict_vars, formdef, condition):