added get_doctype, fixed a minor bug in email recipient list splitting
This commit is contained in:
parent
cdf5b303d5
commit
cb73a34508
5 changed files with 14 additions and 8 deletions
|
|
@ -290,6 +290,10 @@ def model_wrapper(doctype, name=None):
|
|||
|
||||
def get_doclist(doctype, name=None):
|
||||
return model_wrapper(doctype, name).doclist
|
||||
|
||||
def get_doctype(doctype, processed=False):
|
||||
import webnotes.model.doctype
|
||||
return webnotes.model.doctype.get(doctype, processed)
|
||||
|
||||
def delete_doc(doctype=None, name=None, doclist = None, force=0):
|
||||
import webnotes.model
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ def get_fullnames():
|
|||
ret = webnotes.conn.sql("""select name,
|
||||
concat(ifnull(first_name, ''),
|
||||
if(ifnull(last_name, '')!='', ' ', ''), ifnull(last_name, '')),
|
||||
user_image, gender
|
||||
user_image, gender, email
|
||||
from tabProfile where ifnull(enabled, 0)=1""", as_list=1)
|
||||
d = {}
|
||||
for r in ret:
|
||||
|
|
@ -92,7 +92,8 @@ def get_fullnames():
|
|||
else:
|
||||
r[2] = 'files/' + r[2]
|
||||
|
||||
d[r[0]]= {'fullname': r[1], 'image': r[2], 'gender': r[3]}
|
||||
d[r[0]]= {'fullname': r[1], 'image': r[2], 'gender': r[3],
|
||||
'email': r[4] or r[0]}
|
||||
|
||||
return d
|
||||
|
||||
|
|
|
|||
|
|
@ -92,10 +92,10 @@ def validate_email_add(email_str):
|
|||
#return re.match("^[a-zA-Z0-9._%-]+@[a-zA-Z0-9._%-]+.[a-zA-Z]{2,6}$", email_str)
|
||||
return re.match("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", s)
|
||||
|
||||
def sendmail(recipients, sender='', msg='', subject='[No Subject]', parts=[], cc=[], attach=[]):
|
||||
def sendmail(recipients, sender='', msg='', subject='[No Subject]'):
|
||||
"""Send an email. For more details see :func:`email_lib.sendmail`"""
|
||||
import webnotes.utils.email_lib
|
||||
return email_lib.sendmail(recipients, sender, msg, subject, parts, cc, attach)
|
||||
return email_lib.sendmail(recipients, sender, msg, subject)
|
||||
|
||||
def get_request_site_address():
|
||||
"""get app url from request"""
|
||||
|
|
|
|||
|
|
@ -76,4 +76,5 @@ def get_user_date_format():
|
|||
if not user_date_format:
|
||||
global user_date_format
|
||||
user_date_format = webnotes.conn.get_value("Control Panel", None, "date_format")
|
||||
return user_date_format
|
||||
return user_date_format
|
||||
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ class EMail:
|
|||
if isinstance(recipients, basestring):
|
||||
recipients = recipients.replace(';', ',').replace('\n', '')
|
||||
recipients = recipients.split(',')
|
||||
|
||||
|
||||
# remove null
|
||||
recipients = filter(None, recipients)
|
||||
|
||||
recipients = filter(None, (r.strip() for r in recipients))
|
||||
|
||||
self.sender = sender
|
||||
self.reply_to = reply_to or sender
|
||||
self.recipients = recipients
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue