Django

Code

Changeset 7348

Show
Ignore:
Timestamp:
03/21/08 16:08:39 (8 months ago)
Author:
gwilson
Message:

Fixed #6835 -- Use cached FQDN when creating smtplib.SMTP() connection to avoid a lengthy
socket.getfqdn() call, thanks George Murdocca and PhiR.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/mail.py

    r7347 r7348  
    120120            return False 
    121121        try: 
    122             self.connection = smtplib.SMTP(self.host, self.port) 
     122            # If local_hostname is not specified, socket.getfqdn() gets used. 
     123            # For performance, we use the cached FQDN for local_hostname. 
     124            self.connection = smtplib.SMTP(self.host, self.port, 
     125                                           local_hostname=DNS_NAME.get_fqdn()) 
    123126            if self.use_tls: 
    124127                self.connection.ehlo()