Skip to content

Commit

Permalink
Fix warnings.warn calls
Browse files Browse the repository at this point in the history
This fixes an error when these warnings were triggered, for example when
somebody visited the return view directly, without having made a payment.
  • Loading branch information
rfleschenberg committed Nov 7, 2016
1 parent 03f7de8 commit d8b8067
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shop_paypal/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d8b8067

Please sign in to comment.