From 2fb3ae946fd322640e46cfcf140243f0ec228d86 Mon Sep 17 00:00:00 2001 From: Andy McKay Date: Tue, 20 Dec 2011 12:43:42 -0800 Subject: [PATCH] cope with preapproval row being None (bug 712385) --- apps/addons/tests/test_views.py | 1 - apps/paypal/__init__.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/addons/tests/test_views.py b/apps/addons/tests/test_views.py index d12f99c51a..74f086096c 100644 --- a/apps/addons/tests/test_views.py +++ b/apps/addons/tests/test_views.py @@ -597,7 +597,6 @@ class TestPaypalStart(PaypalStart): shared_url('addons.purchase.thanks', self.addon)) - @patch.object(waffle, 'switch_is_active', lambda x: True) @patch.object(settings, 'LOGIN_RATELIMIT_USER', 10) @patch('webapps.models.create_receipt', lambda x: 'receipt') diff --git a/apps/paypal/__init__.py b/apps/paypal/__init__.py index c1bcf5666c..6e52f2de20 100644 --- a/apps/paypal/__init__.py +++ b/apps/paypal/__init__.py @@ -116,7 +116,7 @@ def get_paykey(data): receivers = (data.get('chains', ()), data['email'], data['amount'], data['uuid']) - if 'preapproval' in data: + if data.get('preapproval'): # The paypal_key might be empty if they have removed it. key = data['preapproval'].paypal_key if key: