Ticket #3067: better_servername_caching.patch
File better_servername_caching.patch, 753 bytes (added by , 18 years ago) |
---|
-
django/core/mail.py
8 8 import time 9 9 import random 10 10 11 DNS_NAME = socket.getfqdn() # Cache the hostname 11 # Cache the hostname, but do it "lazily". `getfqdn` can take a couple of 12 # seconds, which slows down the restart of the server (especially noticable 13 # on the development server). 14 class CacheDnsName(object): 15 def __repr__(self): 16 return self.get_fqdn() 17 def get_fqdn(self): 18 if not hasattr(self, '_fqdn'): 19 self._fqdn = socket.getfqdn() 20 return self._fqdn 21 DNS_NAME = CacheDnsName() 12 22 13 23 class BadHeaderError(ValueError): 14 24 pass