diff options
author | Russell Keith-Magee <russell@keith-magee.com> | 2009-11-03 12:53:26 +0000 |
---|---|---|
committer | Russell Keith-Magee <russell@keith-magee.com> | 2009-11-03 12:53:26 +0000 |
commit | aba5389326372be43b2a3bdcda16646fd197e807 (patch) | |
tree | a296f56691d3cb6da4dcbc3a99e16a7eab9a7c43 /django/core/mail/utils.py | |
parent | 8287c27b1895ba56c6680295ff3d202fc7a4b64e (diff) | |
download | django-aba5389326372be43b2a3bdcda16646fd197e807.tar.gz |
Fixed #10355 -- Added an API for pluggable e-mail backends.
Thanks to Andi Albrecht for his work on this patch, and to everyone else that contributed during design and development.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11709 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core/mail/utils.py')
-rw-r--r-- | django/core/mail/utils.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/django/core/mail/utils.py b/django/core/mail/utils.py new file mode 100644 index 0000000000..322a3a1b79 --- /dev/null +++ b/django/core/mail/utils.py @@ -0,0 +1,19 @@ +""" +Email message and email sending related helper functions. +""" + +import socket + + +# Cache the hostname, but do it lazily: socket.getfqdn() can take a couple of +# seconds, which slows down the restart of the server. +class CachedDnsName(object): + def __str__(self): + return self.get_fqdn() + + def get_fqdn(self): + if not hasattr(self, '_fqdn'): + self._fqdn = socket.getfqdn() + return self._fqdn + +DNS_NAME = CachedDnsName() |