diff options
| author | Frédéric van der Essen <fva@openerp.com> | 2012-12-20 17:05:42 +0100 |
|---|---|---|
| committer | Frédéric van der Essen <fva@openerp.com> | 2012-12-20 17:05:42 +0100 |
| commit | faa67b8411b9998798db8119df3446f51954c81b (patch) | |
| tree | b63200b9d1b7d267c1e68d0a082123672ca009ac | |
| parent | 777ed1e0dc9b49a2b55c1f1a8260c07f46a7bacb (diff) | |
[FIX] tools: email regexp was too restrictive
bzr revid: fva@openerp.com-20121220160542-hiuu3drh4fa6j8v5
| -rw-r--r-- | openerp/tools/mail.py | 14 |
1 files 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) |
