From d8b8067050bf3197913b81543e4360271ac58d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Fleschenberg?= Date: Mon, 7 Nov 2016 12:11:14 +0100 Subject: [PATCH] Fix ``warnings.warn`` calls This fixes an error when these warnings were triggered, for example when somebody visited the return view directly, without having made a payment. --- shop_paypal/payment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shop_paypal/payment.py b/shop_paypal/payment.py index 1958a09..2cf40df 100644 --- a/shop_paypal/payment.py +++ b/shop_paypal/payment.py @@ -94,14 +94,14 @@ def return_view(cls, request): payment_id = request.GET['paymentId'] params = {'payer_id': request.GET['PayerID']} except KeyError as err: - warnings.warn("Request for PayPal return_url is invalid: ", err.message) + warnings.warn("Request for PayPal return_url is invalid: {}".format(err.message)) return HttpResponseBadRequest("Invalid Payment Request") try: cls.get_auth_token() payment = paypalrestsdk.Payment.find(payment_id) approved = payment.execute(params) except Exception as err: - warnings.warn("An internal error occurred on the upstream server: ", err.message) + warnings.warn("An internal error occurred on the upstream server: {}".format(err.message)) return cls.cancel_view(request) if approved: cart = CartModel.objects.get_from_request(request)