diff options
| author | Frédéric van der Essen <fva@openerp.com> | 2012-12-28 13:30:23 +0100 |
|---|---|---|
| committer | Frédéric van der Essen <fva@openerp.com> | 2012-12-28 13:30:23 +0100 |
| commit | 28d08ad90171677bb4a020d4aaebcd3b2243dbe6 (patch) | |
| tree | 755667d6fbb8b6b44470210e82c9af5603bf060b | |
| parent | e3d2c92fc689ab26f900f0ed545b19a0af477afb (diff) | |
| parent | 0eac2ff48e8c64883bd4d6b5620547b575461bbe (diff) | |
[MERGE] fix email regexp that was too restrictive
bzr revid: fva@openerp.com-20121228123023-f81amw02iqnmgwxt
| -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 e6b471a26ba..f98ecc9dbd9 100644 --- a/openerp/tools/mail.py +++ b/openerp/tools/mail.py @@ -320,14 +320,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) |
