Changeset 111 for trunk

Show
Ignore:
Timestamp:
11/02/08 13:15:29 (2 months ago)
Author:
fs
Message:

fixes #94

Location:
trunk/turbomail
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/turbomail/api.py

    r109 r111  
    4848 
    4949class Provider(object): 
    50     """docstring for Provider""" 
     50    """A Provider can deliver messages towards their recipients with a specific 
     51    method, e.g. SMTP. They don't care about delivery strategies like queing or 
     52    batch submission.""" 
     53     
    5154    def __init__(self): 
    5255        super(Provider, self).__init__() 
     
    5760     
    5861    def config_get(self, key, default=None, tm2_key=None): 
    59         """Returns the configuration """ 
     62        """Returns the value for the given key from the configuration. If the  
     63        value was not found, the default value (default None) is returned. If  
     64        tm2_key was specified, """ 
    6065        if key in interface.config: 
    6166            value = interface.config.get(key) 
     
    7479        return value 
    7580     
     81     
     82    def stop(self): 
     83        """Called by the manager before the provider instance is destroyed. The 
     84        provider can do some final cleanups (like releasing external resources) 
     85        here.""" 
     86        pass 
    7687 
    7788 
  • trunk/turbomail/managers/immediate.py

    r93 r111  
    5252        except ProviderExhaustedException: 
    5353            log.debug("Provider exhausted.") 
     54            self.provider.stop() 
    5455            self.provider = None 
    5556            self.deliver(message) 
  • trunk/turbomail/providers/smtp.py

    r109 r111  
    6464            self.connection.login(self.user, self.password) 
    6565     
    66     def __del__(self): 
     66    def stop(self): 
    6767        log.debug("Closing SMTP connection.") 
    68          
    6968        if self.connected: 
    7069            self.connection.quit()