Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix bad anonymous_user_email default value
Michal Ociepka2b59980e5e27
diff --git a/checkout/__init__.py b/checkout/__init__.pyindex b223760f31..4f81db5167 100644--- a/checkout/__init__.py+++ b/checkout/__init__.py@@ -14,7 +14,7 @@ class CheckoutStorage(dict):def __init__(self, *args, **kwargs):super(CheckoutStorage, self).__init__(*args, **kwargs)- self.update({'anonymous_user_email': None, 'billing_address': None,+ self.update({'anonymous_user_email': '', 'billing_address': None,'groups': defaultdict(dict), 'summary': False})@@ -58,7 +58,7 @@ class Checkout(ProcessManager):@anonymous_user_email.deleterdef anonymous_user_email(self, email):- self.storage['anonymous_user_email'] = None+ self.storage['anonymous_user_email'] = ''@propertydef billing_address(self):@@ -92,5 +92,8 @@ class Checkout(ProcessManager):order = Order()for step in self.steps:step.add_to_order(order)+ if self.request.user.is_authenticated():+ order.user = self.request.user+ order.anonymous_user_email = ''order.save()return orderdiff --git a/checkout/steps.py b/checkout/steps.pyindex 557b55e72a..d07d8e48fc 100644--- a/checkout/steps.py+++ b/checkout/steps.py@@ -69,7 +69,7 @@ class BaseShippingStep(BaseCheckoutStep):class BillingAddressStep(BaseShippingStep):template = 'checkout/billing.html'- anonymous_user_email = None+ anonymous_user_email = ''def __init__(self, checkout, request):address = checkout.billing_address or Address()