Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Switch exceptions for when a product has no partner

This allows erroneous order creation to be handled gracefully rather
than bombing out.
  • Loading branch information...
commit 93e001e2f51e94bc457fa4bfca12d9cb6f4a2024 1 parent d807577
@codeinthehole codeinthehole authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  oscar/apps/order/utils.py
View
3  oscar/apps/order/utils.py
@@ -4,6 +4,7 @@
from django.utils.translation import ugettext_lazy as _
from oscar.apps.shipping.methods import Free
+from oscar.apps.order.exceptions import UnableToPlaceOrder
from oscar.core.loading import get_class
ShippingAddress = get_model('order', 'ShippingAddress')
Order = get_model('order', 'Order')
@@ -116,7 +117,7 @@ def get_partner_for_product(self, product):
"""
if product.has_stockrecord:
return product.stockrecord.partner
- raise AttributeError(_("No partner found for product '%s'") % product)
+ raise UnableToPlaceOrder(_("No partner found for product '%s'") % product)
def create_line_models(self, order, basket_line, extra_line_fields=None):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.