
vÅÏ^|  ã               @   s   d  Z  Gd d „  d ƒ Z d S)zBase email backend class.c               @   sa   e  Z d  Z d Z d d d „ Z d d „  Z d d „  Z d	 d
 „  Z d d „  Z d d „  Z	 d S)ÚBaseEmailBackenda3  
    Base class for email backend implementations.

    Subclasses must at least overwrite send_messages().

    open() and close() can be called indirectly by using a backend object as a
    context manager:

       with backend as connection:
           # do something with connection
           pass
    Fc             K   s   | |  _  d  S)N)Úfail_silently)Úselfr   Úkwargs© r   ú@/tmp/pip-build-8lau8j11/django/django/core/mail/backends/base.pyÚ__init__   s    zBaseEmailBackend.__init__c             C   s   d S)a+  
        Open a network connection.

        This method can be overwritten by backend implementations to
        open a network connection.

        It's up to the backend implementation to track the status of
        a network connection if it's needed by the backend.

        This method can be called by applications to force a single
        network connection to be used when sending mails. See the
        send_messages() method of the SMTP backend for a reference
        implementation.

        The default implementation does nothing.
        Nr   )r   r   r   r   Úopen   s    zBaseEmailBackend.openc             C   s   d S)zClose a network connection.Nr   )r   r   r   r   Úclose'   s    zBaseEmailBackend.closec             C   s4   y |  j  ƒ  Wn t k
 r/ |  j ƒ  ‚  Yn X|  S)N)r   Ú	Exceptionr	   )r   r   r   r   Ú	__enter__+   s    
zBaseEmailBackend.__enter__c             C   s   |  j  ƒ  d  S)N)r	   )r   Úexc_typeÚ	exc_valueÚ	tracebackr   r   r   Ú__exit__3   s    zBaseEmailBackend.__exit__c             C   s   t  d ƒ ‚ d S)zm
        Send one or more EmailMessage objects and return the number of email
        messages sent.
        zCsubclasses of BaseEmailBackend must override send_messages() methodN)ÚNotImplementedError)r   Zemail_messagesr   r   r   Úsend_messages6   s    zBaseEmailBackend.send_messagesN)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r	   r   r   r   r   r   r   r   r      s   r   N)r   r   r   r   r   r   Ú<module>   s   