ó
rÁìVc           @   sS   d  d l  m Z d  d l m Z d d l m Z d e f d „  ƒ  YZ e ƒ  Z d S(   iÿÿÿÿ(   t   local(   t   get_connectioni   (   t   get_backendt   ConnectionHandlerc           B   s2   e  Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   s~   
    A Cache Handler to manage access to Cache instances.

    Ensures only one instance of each alias exists per thread.
    c         C   s   t  ƒ  |  _ d  S(   N(   R    t   _connections(   t   self(    (    sp   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/django_post_office-2.0.6-py2.7.egg/post_office/connections.pyt   __init__   s    c         C   s    y |  j  j | SWn- t k
 r1 i  |  j  _ n t k
 rA n Xy t | ƒ } Wn! t k
 ru t d | ƒ ‚ n Xt | ƒ } | j ƒ  | |  j  j | <| S(   Ns   %s is not a valid backend alias(   R   t   connectionst   AttributeErrort   KeyErrorR   R   t   open(   R   t   aliast   backendt
   connection(    (    sp   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/django_post_office-2.0.6-py2.7.egg/post_office/connections.pyt   __getitem__   s    
c         C   s   t  |  j d i  ƒ j ƒ  S(   NR   (   t   getattrR   t   values(   R   (    (    sp   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/django_post_office-2.0.6-py2.7.egg/post_office/connections.pyt   all$   s    c         C   s%   x |  j  ƒ  D] } | j ƒ  q Wd  S(   N(   R   t   close(   R   R   (    (    sp   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/django_post_office-2.0.6-py2.7.egg/post_office/connections.pyR   '   s    (   t   __name__t
   __module__t   __doc__R   R   R   R   (    (    (    sp   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/django_post_office-2.0.6-py2.7.egg/post_office/connections.pyR   	   s
   			N(	   t	   threadingR    t   django.core.mailR   t   settingsR   t   objectR   R   (    (    (    sp   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/django_post_office-2.0.6-py2.7.egg/post_office/connections.pyt   <module>   s   #