ó
ú2ec           @   s‡   d  Z  y d d l Z Wn' e k
 r? d e f d „  ƒ  YZ nD Xy e j Z Wn3 e k
 r‚ d d l Z d e f d „  ƒ  YZ n Xd S(   sl   
Implementation of thread-local storage, for Python versions that don't
have thread local storage natively.
iÿÿÿÿNt   localc           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    sC   /usr/local/lib/python2.7/dist-packages/paste/util/threadinglocal.pyR       s   c           B   s>   e  Z d  „  Z e j d „ Z e j d „ Z e j d „ Z RS(   c         C   s   i  |  j  d <d  S(   Nt   __objs(   t   __dict__(   t   self(    (    sC   /usr/local/lib/python2.7/dist-packages/paste/util/threadinglocal.pyt   __init__   s    c         C   sK   y |  j  d | ƒ  | SWn* t k
 rF t d | | ƒ  f ƒ ‚ n Xd  S(   NR   s(   No variable %s defined for the thread %s(   R   t   KeyErrort   AttributeError(   R   t   attrt   g(    (    sC   /usr/local/lib/python2.7/dist-packages/paste/util/threadinglocal.pyt   __getattr__   s    c         C   s$   | |  j  d j | ƒ  i  ƒ | <d  S(   NR   (   R   t
   setdefault(   R   R	   t   valueR
   (    (    sC   /usr/local/lib/python2.7/dist-packages/paste/util/threadinglocal.pyt   __setattr__!   s    c         C   sJ   y |  j  d | ƒ  | =Wn* t k
 rE t d | | ƒ  f ƒ ‚ n Xd  S(   NR   s$   No variable %s defined for thread %s(   R   R   R   (   R   R	   R
   (    (    sC   /usr/local/lib/python2.7/dist-packages/paste/util/threadinglocal.pyt   __delattr__$   s    (   R   R   R   t   threadt	   get_identR   R   R   (    (    (    sC   /usr/local/lib/python2.7/dist-packages/paste/util/threadinglocal.pyR       s   	(   t   __doc__t	   threadingt   ImportErrort   objectR    R   R   (    (    (    sC   /usr/local/lib/python2.7/dist-packages/paste/util/threadinglocal.pyt   <module>   s   