Error handling for idna encoding

master
hoellen 5 years ago
parent 5dbf430241
commit 10034526a1

@ -27,7 +27,10 @@ class IdnaDomain(db.TypeDecorator):
impl = db.String(80) impl = db.String(80)
def process_bind_param(self, value, dialect): def process_bind_param(self, value, dialect):
try:
return idna.encode(value).decode("ascii").lower() return idna.encode(value).decode("ascii").lower()
except ValueError:
pass
def process_result_value(self, value, dialect): def process_result_value(self, value, dialect):
return idna.decode(value) return idna.decode(value)

@ -0,0 +1 @@
Error handling in idna encoding
Loading…
Cancel
Save