
vÅÏ^t  ã               @   s@   d  Z  d d l m Z d d l m Z Gd d „  d e ƒ Z d S)z
Backend for test environment.
é    )Úmail)ÚBaseEmailBackendc                   s4   e  Z d  Z d Z ‡  f d d †  Z d d „  Z ‡  S)ÚEmailBackendzó
    An email backend for use during test sessions.

    The test connection stores email messages in a dummy outbox,
    rather than sending them out on the wire.

    The dummy outbox is accessible through the outbox instance attribute.
    c                s/   t  ƒ  j | | Ž  t t d ƒ s+ g  t _ d  S)NÚoutbox)ÚsuperÚ__init__Úhasattrr   r   )ÚselfÚargsÚkwargs)Ú	__class__© úB/tmp/pip-build-8lau8j11/django/django/core/mail/backends/locmem.pyr      s    zEmailBackend.__init__c             C   s?   d } x2 | D]* } | j  ƒ  t j j | ƒ | d 7} q W| S)z%Redirect messages to the dummy outboxr   é   )Úmessager   r   Úappend)r	   ÚmessagesZ	msg_countr   r   r   r   Úsend_messages   s    
zEmailBackend.send_messages)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   )r   r   r   	   s   r   N)r   Zdjango.corer   Zdjango.core.mail.backends.baser   r   r   r   r   r   Ú<module>   s   