本文整理汇总了Python中webnotes.utils.validate_email_add函数的典型用法代码示例。如果您正苦于以下问题:Python validate_email_add函数的具体用法?Python validate_email_add怎么用?Python validate_email_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了validate_email_add函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: validate_email
def validate_email(self):
if self.doc.company_email and not validate_email_add(self.doc.company_email):
msgprint("Please enter valid Company Email")
raise Exception
if self.doc.personal_email and not validate_email_add(self.doc.personal_email):
msgprint("Please enter valid Personal Email")
raise Exception
示例2: validate
def validate(self):
from webnotes.utils import validate_email_add
# validate ids
if self.sender and (not validate_email_add(self.sender)):
raise Exception, "%s is not a valid email id" % self.sender
if self.reply_to and (not validate_email_add(self.reply_to)):
raise Exception, "%s is not a valid email id" % reply_to
for e in self.recipients:
if not validate_email_add(e):
raise Exception, "%s is not a valid email id" % e
示例3: _validate
def _validate(email):
"""validate an email field"""
if email:
if "," in email:
email = email.split(",")[-1]
if not validate_email_add(email):
# try extracting the email part and set as sender
new_email = extract_email_id(email)
if not (new_email and validate_email_add(new_email)):
webnotes.msgprint("%s is not a valid email id" % email,
raise_exception = 1)
email = new_email
return email
示例4: add_profile
def add_profile(email):
from webnotes.utils import validate_email_add
from webnotes.model.doc import Document
sql = webnotes.conn.sql
if not email:
email = webnotes.form_dict.get('user')
if not validate_email_add(email):
raise Exception
return 'Invalid Email Id'
if sql("select name from tabProfile where name = %s", email):
# exists, enable it
sql("update tabProfile set enabled = 1, docstatus=0 where name = %s", email)
webnotes.msgprint('Profile exists, enabled it')
else:
# does not exist, create it!
pr = Document('Profile')
pr.name = email
pr.email = email
pr.enabled=1
pr.user_type='System User'
pr.save(1)
from webnotes.model.code import get_obj
pr_obj = get_obj(doc=pr)
pr_obj.on_update()
示例5: validate_email_type
def validate_email_type(self, email):
from webnotes.utils import validate_email_add
email = email.strip()
if not validate_email_add(email):
webnotes.msgprint("%s is not a valid email id" % email)
raise Exception
示例6: add_profile
def add_profile(args):
from webnotes.utils import validate_email_add
from webnotes.model.doc import Document
email = args['user']
sql = webnotes.conn.sql
if not email:
email = webnotes.form_dict.get('user')
if not validate_email_add(email):
raise Exception
return 'Invalid Email Id'
if sql("select name from tabProfile where name = %s", email):
# exists, enable it
sql("update tabProfile set enabled = 1, docstatus=0 where name = %s", email)
webnotes.msgprint('Profile exists, enabled it')
else:
# does not exist, create it!
pr = Document('Profile')
pr.name = email
pr.email = email
pr.first_name = args.get('first_name')
pr.last_name = args.get('last_name')
pr.enabled = 1
pr.user_type = 'System User'
pr.save(1)
if args.get('password'):
sql("""
UPDATE tabProfile
SET password = PASSWORD(%s)
WHERE name = %s""", (args.get('password'), email))
示例7: _validate
def _validate(email):
"""validate an email field"""
if email and not validate_email_add(email):
throw("{email} {msg}".format(**{
"email": email,
"msg": _("is not a valid email id")
}))
return email
示例8: validate
def validate(self):
"""validate the email ids"""
if not self.sender:
self.sender = webnotes.conn.get_value('Email Settings', None, 'auto_email_id') \
or getattr(conf, 'auto_email_id', 'ERPNext Notification <[email protected]>')
from webnotes.utils import validate_email_add
# validate ids
if self.sender and (not validate_email_add(self.sender)):
webnotes.msgprint("%s is not a valid email id" % self.sender, raise_exception = 1)
if self.reply_to and (not validate_email_add(self.reply_to)):
webnotes.msgprint("%s is not a valid email id" % self.reply_to, raise_exception = 1)
for e in self.recipients + (self.cc or []):
if e.strip() and not validate_email_add(e):
webnotes.msgprint("%s is not a valid email id" % e, raise_exception = 1)
示例9: send_email_notification
def send_email_notification(self):
if not validate_email_add(self.doc.email_id.strip(' ')):
msgprint('error:%s is not a valid email id' % self.doc.email_id.strip(' '))
raise Exception
else:
subject = 'Thank you for interest in erpnext'
sendmail([self.doc.email_id.strip(' ')], sender = sender_email[0][0], subject = subject , parts = [['text/html', self.get_notification_msg()]])
msgprint("Mail Sent")
示例10: validate
def validate(self):
if self.doc.personal_email:
if not validate_email_add(self.doc.personal_email):
msgprint("Please enter valid Personal Email")
raise Exception
ret = sql("select name from `tabEmployee Profile` where employee = '%s' and name !='%s'"%(self.doc.employee,self.doc.name))
if ret:
msgprint("Employee Profile is already created for Employee : '%s'"%self.doc.employee)
raise Exception
示例11: validate
def validate(self):
"""
validate the email ids
"""
if not self.sender:
self.sender = webnotes.conn.get_value('Control Panel',None,'auto_email_id')
from webnotes.utils import validate_email_add
# validate ids
if self.sender and (not validate_email_add(self.sender)):
webnotes.msgprint("%s is not a valid email id" % self.sender, raise_exception = 1)
if self.reply_to and (not validate_email_add(self.reply_to)):
webnotes.msgprint("%s is not a valid email id" % self.reply_to, raise_exception = 1)
for e in self.recipients:
if not validate_email_add(e):
webnotes.msgprint("%s is not a valid email id" % e, raise_exception = 1)
示例12: validate_notification_email_id
def validate_notification_email_id(self):
if self.doc.notification_email_address:
from webnotes.utils import validate_email_add
for add in self.doc.notification_email_address.replace('\n', '').replace(' ', '').split(","):
if add and not validate_email_add(add):
msgprint("%s is not a valid email address" % add, raise_exception=1)
else:
msgprint("Notification Email Addresses not specified for recurring invoice",
raise_exception=1)
示例13: validate_email_type
def validate_email_type(self, email):
from webnotes.utils import validate_email_add
email = email.strip()
if not validate_email_add(email):
throw("{email} {msg}".format(**{
"email": email,
"msg": _("is not a valid email id")
}))
示例14: validate
def validate(self):
self.set_status()
if self.doc.source == 'Campaign' and not self.doc.campaign_name and session['user'] != 'Guest':
webnotes.throw("Please specify campaign name")
if self.doc.email_id:
if not validate_email_add(self.doc.email_id):
webnotes.throw('Please enter valid email id.')
示例15: validate
def validate(self):
"""
validate the email ids
"""
if not self.sender:
self.sender = hasattr(conf, 'auto_email_id') \
and conf.auto_email_id or '"ERPNext Notification" <[email protected]>'
from webnotes.utils import validate_email_add
# validate ids
if self.sender and (not validate_email_add(self.sender)):
webnotes.msgprint("%s is not a valid email id" % self.sender, raise_exception = 1)
if self.reply_to and (not validate_email_add(self.reply_to)):
webnotes.msgprint("%s is not a valid email id" % self.reply_to, raise_exception = 1)
for e in self.recipients:
if not validate_email_add(e):
webnotes.msgprint("%s is not a valid email id" % e, raise_exception = 1)