[REVIEW] tools: moved email_split function in emails section, instead of 'somwhere...
authorThibault Delavallée <tde@openerp.com>
Tue, 28 Aug 2012 07:34:14 +0000 (09:34 +0200)
committerThibault Delavallée <tde@openerp.com>
Tue, 28 Aug 2012 07:34:14 +0000 (09:34 +0200)
bzr revid: tde@openerp.com-20120828073414-lt4bpubxtv3235b6

openerp/tools/misc.py

index 024d75f..f609981 100644 (file)
@@ -395,6 +395,11 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non
         cr.close()
     return res
 
+def email_split(text):
+    """ Return a list of the email addresses found in ``text`` """
+    if not text: return []
+    return re.findall(r'([^ ,<@]+@[^> ,]+)', text)
+
 #----------------------------------------------------------
 # SMS
 #----------------------------------------------------------