|
|
@ -35,11 +35,14 @@ class IdnaEmail(db.TypeDecorator):
|
|
|
|
impl = db.String(255, collation="NOCASE")
|
|
|
|
impl = db.String(255, collation="NOCASE")
|
|
|
|
|
|
|
|
|
|
|
|
def process_bind_param(self, value, dialect):
|
|
|
|
def process_bind_param(self, value, dialect):
|
|
|
|
localpart, domain_name = value.split('@')
|
|
|
|
try:
|
|
|
|
return "{0}@{1}".format(
|
|
|
|
localpart, domain_name = value.split('@')
|
|
|
|
localpart,
|
|
|
|
return "{0}@{1}".format(
|
|
|
|
idna.encode(domain_name).decode('ascii'),
|
|
|
|
localpart,
|
|
|
|
)
|
|
|
|
idna.encode(domain_name).decode('ascii'),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
except ValueError:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def process_result_value(self, value, dialect):
|
|
|
|
def process_result_value(self, value, dialect):
|
|
|
|
localpart, domain_name = value.split('@')
|
|
|
|
localpart, domain_name = value.split('@')
|
|
|
|