From b2065093454a832c988065db526964db8ea42608 Mon Sep 17 00:00:00 2001 From: Martin Gross Date: Wed, 8 Jun 2022 13:30:12 +0200 Subject: [PATCH] PPv2: ISU-Return: explicitly set incr cache key if not set --- src/pretix/plugins/paypal2/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pretix/plugins/paypal2/views.py b/src/pretix/plugins/paypal2/views.py index b9f825db4..b96005121 100644 --- a/src/pretix/plugins/paypal2/views.py +++ b/src/pretix/plugins/paypal2/views.py @@ -205,7 +205,10 @@ def isu_return(request, *args, **kwargs): # Cached access tokens are not updated by PayPal to include new Merchants that granted access rights since # the access token was generated. Therefor we increment the cycle count and by that invalidate the cached # token and pull a new one. - cache.incr('pretix_paypal_token_hash_cycle') + try: + cache.incr('pretix_paypal_token_hash_cycle') + except ValueError: + cache.set('pretix_paypal_token_hash_cycle', 0) gs = GlobalSettingsObject() prov = Paypal(event)