Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Use smart_text instead of str
Michał Ociepka0891b2da6f89
diff --git a/saleor/checkout/core.py b/saleor/checkout/core.pyindex 062a0ada88..8ac02a61e5 100644--- a/saleor/checkout/core.py+++ b/saleor/checkout/core.py@@ -4,6 +4,7 @@ from functools import wrapsfrom django.conf import settingsfrom django.db import transactionfrom django.forms.models import model_to_dict+from django.utils.encoding import smart_textfrom prices import Price, FixedDiscountfrom ..cart import Cart@@ -81,7 +82,7 @@ class Checkout(object):@shipping_address.setterdef shipping_address(self, address):address_data = model_to_dict(address)- address_data['country'] = str(address_data['country'])+ address_data['country'] = smart_text(address_data['country'])self.storage['shipping_address'] = address_dataself.modified = True@@ -129,7 +130,7 @@ class Checkout(object):@billing_address.setterdef billing_address(self, address):address_data = model_to_dict(address)- address_data['country'] = str(address_data['country'])+ address_data['country'] = smart_text(address_data['country'])self.storage['billing_address'] = address_dataself.modified = True@@ -145,7 +146,7 @@ class Checkout(object):@discount.setterdef discount(self, discount):amount = discount.amount- self.storage['discount_value'] = str(amount.net)+ self.storage['discount_value'] = smart_text(amount.net)self.storage['discount_currency'] = amount.currencyself.storage['discount_name'] = discount.nameself.modified = True@@ -225,7 +226,7 @@ class Checkout(object):shipping_required = partition.is_shipping_required()if shipping_required:shipping_price = self.shipping_method.get_total()- shipping_method_name = str(self.shipping_method)+ shipping_method_name = smart_text(self.shipping_method)else:shipping_price = 0shipping_method_name = None