From 58d59631fcb22cc4d181270a10aab8b78f5ce2ed Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Wed, 8 Apr 2020 09:59:48 +0200 Subject: [PATCH 1/2] lingo: backend options must be dict (#41439) --- combo/apps/lingo/models.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/combo/apps/lingo/models.py b/combo/apps/lingo/models.py index e5d799ef..b5cc3632 100644 --- a/combo/apps/lingo/models.py +++ b/combo/apps/lingo/models.py @@ -103,14 +103,17 @@ class PaymentBackend(models.Model): return self.label def get_payment(self): - if isinstance(self.service_options, six.string_types): + options = self.service_options or {} + if isinstance(options, six.string_types): # backward compatibility when used againt postgresql < 9.4 and # service_options is received as a string. try: - self.service_options = json.loads(self.service_options) + options = json.loads(options) except ValueError: pass - return eopayment.Payment(self.service, self.service_options) + if not isinstance(options, dict): + options = {} + return eopayment.Payment(self.service, options) @python_2_unicode_compatible -- 2.24.0