mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #30608 -- Fixed non-unicode EmailMessage crash when domain name for localhost is non-ASCII.
Assisted by felixxm.
This commit is contained in:
committed by
Mariusz Felisiak
parent
f226bdbf4e
commit
55b68de643
@@ -4,6 +4,8 @@ Email message and email sending related helper functions.
|
||||
|
||||
import socket
|
||||
|
||||
from django.utils.encoding import punycode
|
||||
|
||||
|
||||
# Cache the hostname, but do it lazily: socket.getfqdn() can take a couple of
|
||||
# seconds, which slows down the restart of the server.
|
||||
@@ -13,7 +15,7 @@ class CachedDnsName:
|
||||
|
||||
def get_fqdn(self):
|
||||
if not hasattr(self, '_fqdn'):
|
||||
self._fqdn = socket.getfqdn()
|
||||
self._fqdn = punycode(socket.getfqdn())
|
||||
return self._fqdn
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user