
    Og                     >   d Z dZddlZddlZ	 ddlmZ ddlmZ ddl	m
Z
 ddl	mZ  G d	 d
e      Z G d dej                        Z e       ZddZd Zej&                  d        ZddZddZd Zd ZeZ	 ddlmZ  ee       y# e$ r d ZY |w xY w# e$ r Y yw xY w)zEHooks for getting and setting a site in the thread global namespace.
restructuredtext    N)removeSecurityProxyc                     | S N )xs    O/var/www/djangounited/venv/lib/python3.12/site-packages/zope/component/hooks.pyr   r      s        )getGlobalSiteManager)ComponentLookupError)IComponentLookupc                       e Zd ZdZd Zd Zy)read_propertyzDescriptor for property-like computed attributes.

    Unlike the standard 'property', this descriptor allows assigning a
    value to the instance, shadowing the property getter function.
    c                     || _         y r   func)selfr   s     r	   __init__zread_property.__init__&   s	    	r
   c                 ,    || S | j                  |      S r   r   )r   instclss      r	   __get__zread_property.__get__)   s    <Kyyr
   N)__name__
__module____qualname____doc__r   r   r   r
   r	   r   r       s    
r
   r   c                   .    e Zd ZdZ e       Zed        Zy)SiteInfoNc                 T    | j                   j                  j                  }|| _        |S r   )smadaptersadapter_hook)r   r"   s     r	   r"   zSiteInfo.adapter_hook3   s%    ww''44(r
   )r   r   r   siter   r    r   r"   r   r
   r	   r   r   /   s!    D		B r
   r   c                     | t               }nt        |       } | j                         }| t        _        |t        _        	 t        `y # t        $ r Y y w xY wr   )r   r   getSiteManagersiteinfor#   r    r"   AttributeError)r#   r    s     r	   setSiter(   ;   sT    |!# #4(  "HMHK! s    A 	AAc                  "    t         j                  S r   )r&   r#   r   r
   r	   getSiter*   R   s    ==r
   c              #   v   K   t               }t        |        	 d  t        |       y # t        |       w xY wwr   )r*   r(   )r#   old_sites     r	   r#   r#   V   s,     yHDMs   9) 969c                 h    | t         j                  S t        | t                     }t	        |      }|S )zA special hook for getting the site manager.

    Here we take the currently set site into account to find the appropriate
    site manager.
    )r&   r    r   r   r   )contextr    s     r	   r%   r%   `   s7     {{ 
%'
)B	R	 BIr
   c                 V    	 t         j                  | |||      S # t        $ r |cY S w xY wr   )r&   r"   r   )	interfaceobjectnamedefaults       r	   r"   r"   u   s2    $$YgFF s    ((c                      ddl m}  | j                  j                  t               | j                  j                  t               y Nr   _api)zope.componentr7   r"   sethookr%   r6   s    r	   setHooksr:   |   s-    #l+/r
   c                      ddl m}  | j                  j                          | j                  j                          	 t
        `y # t        $ r Y y w xY wr5   )r8   r7   r"   resetr%   r&   r'   r6   s    r	   
resetHooksr=      sF    #! s   A 	AA)
addCleanUpr   ) N)r   __docformat__
contextlib	threadingzope.security.proxyr   ImportErrorzope.component.globalregistryr   zope.component.interfacesr   r   r1   r   localr   r&   r(   r*   contextmanagerr#   r%   r"   r:   r=   	clearSitezope.testing.cleanupr>   r   r
   r	   <module>rK      s   "  7
 ? : 6F y  :.  *0

 	/ z{  t  		s#   B 7B BBBB