From faa67b8411b9998798db8119df3446f51954c81b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Thu, 20 Dec 2012 17:05:42 +0100 Subject: [PATCH] [FIX] tools: email regexp was too restrictive bzr revid: fva@openerp.com-20121220160542-hiuu3drh4fa6j8v5 --- openerp/tools/mail.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/openerp/tools/mail.py b/openerp/tools/mail.py index a54f99ba1ad..1c76b670558 100644 --- a/openerp/tools/mail.py +++ b/openerp/tools/mail.py @@ -316,14 +316,12 @@ def append_content_to_html(html, content, plaintext=True, preserve=False, contai # Emails #---------------------------------------------------------- -email_re = re.compile(r""" - ([a-zA-Z][\w\.-]*[a-zA-Z0-9] # username part - @ # mandatory @ sign - [a-zA-Z0-9][\w\.-]* # domain must start with a letter ... Ged> why do we include a 0-9 then? - \. - [a-z]{2,3} # TLD - ) - """, re.VERBOSE) +# matches any email in a body of text +email_re = re.compile(r"""([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})""", re.VERBOSE) + +# matches a string containing only one email +single_email_re = re.compile(r"""^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$""", re.VERBOSE) + res_re = re.compile(r"\[([0-9]+)\]", re.UNICODE) command_re = re.compile("^Set-([a-z]+) *: *(.+)$", re.I + re.UNICODE)