瀏覽代碼

[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 12 年之前
父節點
當前提交
7467a7f5f7
共有 1 個檔案被更改,包括 13 行新增6 行删除
  1. 13
    6
      oscar/apps/checkout/mixins.py

+ 13
- 6
oscar/apps/checkout/mixins.py 查看文件

@@ -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)

Loading…
取消
儲存