def requires_non_ascii(self):
"""
Can the address be converted to an ASCII compatible encoding?
"""
if not is_pure_ascii(self.mailbox):
return True
if not is_pure_ascii(self.hostname):
try:
idna.encode(self.hostname)
except idna.IDNAError:
return True
return False
评论列表
文章目录