You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.py 452B

1234567891011121314151617181920
  1. """
  2. Email message and email sending related helper functions.
  3. """
  4. import socket
  5. # Cache the hostname, but do it lazily: socket.getfqdn() can take a couple of
  6. # seconds, which slows down the restart of the server.
  7. class CachedDnsName:
  8. def __str__(self):
  9. return self.get_fqdn()
  10. def get_fqdn(self):
  11. if not hasattr(self, '_fqdn'):
  12. self._fqdn = socket.getfqdn()
  13. return self._fqdn
  14. DNS_NAME = CachedDnsName()