Sfoglia il codice sorgente

added get_email_id to webnotes.utils

version-14
Anand Doshi 13 anni fa
parent
commit
ecab71bbb5
1 ha cambiato i file con 8 aggiunte e 0 eliminazioni
  1. +8
    -0
      py/webnotes/utils/__init__.py

+ 8
- 0
py/webnotes/utils/__init__.py Vedi File

@@ -77,6 +77,14 @@ def extract_email_id(s):
s = s.strip().lower() s = s.strip().lower()
return s return s
def get_email_id(user):
"""get email id of user formatted as: John Doe <johndoe@example.com>"""
if user == "Administrator":
return user
fullname = get_fullname(user)
return "%s <%s>" % (fullname, user)
def validate_email_add(email_str): def validate_email_add(email_str):
"""Validates the email string""" """Validates the email string"""
s = extract_email_id(email_str) s = extract_email_id(email_str)


Caricamento…
Annulla
Salva