From ecab71bbb5fd3901f762d9fb2d5cea9d6f7e45bf Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 24 Aug 2012 15:18:28 +0530 Subject: [PATCH] added get_email_id to webnotes.utils --- py/webnotes/utils/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/py/webnotes/utils/__init__.py b/py/webnotes/utils/__init__.py index 9099eecbd3..dfbbe03dde 100644 --- a/py/webnotes/utils/__init__.py +++ b/py/webnotes/utils/__init__.py @@ -77,6 +77,14 @@ def extract_email_id(s): s = s.strip().lower() return s +def get_email_id(user): + """get email id of user formatted as: John Doe """ + if user == "Administrator": + return user + + fullname = get_fullname(user) + return "%s <%s>" % (fullname, user) + def validate_email_add(email_str): """Validates the email string""" s = extract_email_id(email_str)