[FIX] payment_paypal: avoid json decode error

with post.pop('custom', '{}'), if the key 'custom' is not there, it will return '{}', but if the key is there, but the value is equivalent to False, the json decode will fail.
This commit is contained in:
Denis Ledoux 2014-09-03 15:19:26 +02:00
parent 1ff7ed2758
commit 00ea919699
1 changed files with 1 additions and 1 deletions

View File

@ -24,7 +24,7 @@ class PaypalController(http.Controller):
""" Extract the return URL from the data coming from paypal. """
return_url = post.pop('return_url', '')
if not return_url:
custom = json.loads(post.pop('custom', '{}'))
custom = json.loads(post.pop('custom', False) or '{}')
return_url = custom.get('return_url', '/')
return return_url