details:   https://code.tryton.org/tryton/commit/643142484aee
branch:    default
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
diffstat:

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

diffs (33 lines):

diff -r f33086da7706 -r 643142484aee modules/web_shop_shopify/party.py
--- a/modules/web_shop_shopify/party.py Sun Nov 30 08:45:34 2025 +0100
+++ b/modules/web_shop_shopify/party.py Mon Nov 17 14:38:07 2025 +0100
@@ -1,11 +1,16 @@
 # 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.model import sequence_reorder
 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'
@@ -41,6 +46,12 @@
                             contact_mechanisms.pop(i))
                         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.insert(index, ContactMechanism(
                         type=types[0], value=value))
         party.contact_mechanisms = sequence_reorder(contact_mechanisms)

Reply via email to