Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Clean up the format_address method (#6830)
Maciej Korycinski1df5177401ac
diff --git a/saleor/plugins/email_common.py b/saleor/plugins/email_common.pyindex 79fd28bae0..02e0bdbf22 100644--- a/saleor/plugins/email_common.py+++ b/saleor/plugins/email_common.py@@ -15,7 +15,6 @@ from django.contrib.sites.models import Sitefrom django.core.exceptions import ValidationErrorfrom django.core.mail import send_mailfrom django.core.mail.backends.smtp import EmailBackend-from django.utils.translation import pgettextfrom django_prices.utils.locale import get_locale_datafrom .base_plugin import ConfigurationTypeField@@ -126,11 +125,11 @@ DEFAULT_EMAIL_CONFIG_STRUCTURE = {def format_address(this, address, include_phone=True, inline=False, latin=False):- address["name"] = pgettext("Address data", "%(first_name)s %(last_name)s") % address+ address["name"] = f"{address.get('first_name', '')} {address.get('last_name', '')}"address["country_code"] = address["country"]- address["street_address"] = pgettext(- "Address data", "%(street_address_1)s\n" "%(street_address_2)s" % address- )+ address[+ "street_address"+ ] = f"{address.get('street_address_1','')}\n {address.get('street_address_2','')}"address_lines = i18naddress.format_address(address, latin).split("\n")phone = address.get("phone")if include_phone and phone: