Skip to content
Browse files

Added hook method for freezing basket in checkout.

So that it can be disabled by subclassing.
  • Loading branch information...
1 parent 575abb6 commit f220c02f8c2ce883a454e4e294051bb08da47616 @codeinthehole codeinthehole committed
Showing with 9 additions and 6 deletions.
  1. +1 −1 oscar/__init__.py
  2. +8 −5 oscar/apps/checkout/views.py
View
2 oscar/__init__.py
@@ -1,7 +1,7 @@
# Use 'final' as the 4th element to indicate
# a full release
#VERSION = (0, 1, 0, 'beta', 18)
-VERSION = (0, 1, 1, 'final')
+VERSION = (0, 1, 2, 'final')
def get_short_version():
return '%s.%s' % (VERSION[0], VERSION[1])
View
13 oscar/apps/checkout/views.py
@@ -564,11 +564,7 @@ def submit(self, basket, **kwargs):
order_number = self.generate_order_number(basket)
logger.info("Order #%s: beginning submission process for basket %d", order_number, basket.id)
- # We freeze the basket to prevent it being modified once the payment
- # process has started. If your payment fails, then the basket will
- # need to be "unfrozen". We also store the basket ID in the session
- # so the it can be retrieved by multistage checkout processes.
- basket.freeze()
+ self.freeze_basket(basket)
self.checkout_session.set_submitted_basket(basket)
# Handle payment. Any payment problems should be handled by the
@@ -607,6 +603,13 @@ def generate_order_number(self, basket):
order_number = generator.order_number(basket)
self.checkout_session.set_order_number(order_number)
return order_number
+
+ def freeze_basket(self, basket):
+ # We freeze the basket to prevent it being modified once the payment
+ # process has started. If your payment fails, then the basket will
+ # need to be "unfrozen". We also store the basket ID in the session
+ # so the it can be retrieved by multistage checkout processes.
+ basket.freeze()
def handle_payment(self, order_number, total, **kwargs):
"""

0 comments on commit f220c02

Please sign in to comment.
Something went wrong with that request. Please try again.