From 8d9d564e7e64d1236c269e6babacb0bba760c310 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Wed, 1 Jun 2016 00:57:11 +0200 Subject: [PATCH] sleep 2 seconds, add debug output --- shop/views.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shop/views.py b/shop/views.py index 10228f4c..a29e144f 100644 --- a/shop/views.py +++ b/shop/views.py @@ -387,16 +387,21 @@ class CoinifyRedirectView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureUn def dispatch(self, request, *args, **kwargs): order = self.get_object() + print "checking if order %s has coinifyapiinvoice" % order.pk if hasattr(order, 'coinifyapiinvoice'): # we already have a coinifyinvoice for this order, # check if it expired + print "order %s has coinifyapiinvoice, check expire time.." % order.pk if parse_datetime(order.coinifyapiinvoice.invoicejson['expire_time']) < timezone.now(): # this coinifyinvoice expired, delete it + print "order %s has an expired coinifyapiinvoice, delete it.." % order.pk order.coinifyapiinvoice.delete() - time.sleep(1) + time.sleep(2) # create a new coinify invoice if needed + print "checking if order %s has coinifyapiinvoice" % order.pk if not hasattr(order, 'coinifyapiinvoice'): + print "order %s has no coinifyapiinvoice, creating one.." % order.pk # Initiate coinify API coinifyapi = CoinifyAPI( settings.COINIFY_API_KEY, @@ -431,6 +436,7 @@ class CoinifyRedirectView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureUn order = order, ) + print "done" % order.pk return super(CoinifyRedirectView, self).dispatch( request, *args, **kwargs )