Procházet zdrojové kódy

[Port] Handle case where anon order status view is not registered

Some sites may not include that URL and so we should swallow the
resolution exception to enable checkout to process as normal.

(cherry picked from commit 70ddc185b1)

Conflicts:
	oscar/apps/checkout/mixins.py
master
David Winterbottom před 12 roky
rodič
revize
7467a7f5f7
1 změnil soubory, kde provedl 13 přidání a 6 odebrání
  1. 13
    6
      oscar/apps/checkout/mixins.py

+ 13
- 6
oscar/apps/checkout/mixins.py Zobrazit soubor

@@ -1,7 +1,7 @@
1 1
 import logging
2 2
 
3 3
 from django.http import HttpResponseRedirect
4
-from django.core.urlresolvers import reverse
4
+from django.core.urlresolvers import reverse, NoReverseMatch
5 5
 from django.contrib.sites.models import Site, get_current_site
6 6
 from django.core.exceptions import ObjectDoesNotExist
7 7
 from django.db.models import get_model
@@ -323,11 +323,18 @@ class OrderPlacementMixin(CheckoutSessionMixin):
323 323
                'lines': order.lines.all()}
324 324
 
325 325
         if not self.request.user.is_authenticated():
326
-            path = reverse('customer:anon-order',
327
-                           kwargs={'order_number': order.number,
328
-                                   'hash': order.verification_hash()})
329
-            site = Site.objects.get_current()
330
-            ctx['status_url'] = 'http://%s%s' % (site.domain, path)
326
+            # Attempt to add the anon order status URL to the email template
327
+            # ctx.
328
+            try:
329
+                path = reverse('customer:anon-order',
330
+                               kwargs={'order_number': order.number,
331
+                                       'hash': order.verification_hash()})
332
+            except NoReverseMatch:
333
+                # We don't care that much if we can't resolve the URL
334
+                pass
335
+            else:
336
+                site = Site.objects.get_current()
337
+                ctx['status_url'] = 'http://%s%s' % (site.domain, path)
331 338
 
332 339
         try:
333 340
             event_type = CommunicationEventType.objects.get(code=code)

Načítá se…
Zrušit
Uložit