details:   https://code.tryton.org/tryton/commit/2d554fce0883
branch:    7.0
user:      Cédric Krier <[email protected]>
date:      Mon Nov 17 14:38:07 2025 +0100
description:
        Do not create contact mechanism for invalid email from Shopify

        Closes #14368
        (grafted from 643142484aee74972d3caee2c4a449f8f4abba7e)
diffstat:

 modules/web_shop_shopify/party.py |  11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diffs (32 lines):

diff -r b2e610ddec2e -r 2d554fce0883 modules/web_shop_shopify/party.py
--- a/modules/web_shop_shopify/party.py Wed Nov 26 16:41:20 2025 +0100
+++ b/modules/web_shop_shopify/party.py Mon Nov 17 14:38:07 2025 +0100
@@ -1,10 +1,15 @@
 # This file is part of Tryton.  The COPYRIGHT file at the top level of
 # this repository contains the full copyright notices and license terms.
+import logging
+
 from trytond.pool import Pool, PoolMeta
 from trytond.tools import remove_forbidden_chars
+from trytond.tools.email_ import EmailNotValidError, validate_email
 
 from .common import IdentifiersMixin, setattr_changed
 
+logger = logging.getLogger(__name__)
+
 
 class Party(IdentifiersMixin, metaclass=PoolMeta):
     __name__ = 'party.party'
@@ -34,6 +39,12 @@
                                 value, contact_mechanism.type))):
                     break
             else:
+                if types[0] == 'email':
+                    try:
+                        validate_email(value)
+                    except EmailNotValidError as e:
+                        logger.info("Skip email %s", value, exc_info=e)
+                        continue
                 contact_mechanisms.append(ContactMechanism(
                         type=types[0], value=value))
         party.contact_mechanisms = contact_mechanisms

Reply via email to