lingo: backend options must be dict (#41439)
This commit is contained in:
parent
a40dc2e73f
commit
ead8de9bcc
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue