Your IP : 216.73.216.172


Current Path : /lib/python3/dist-packages/zope/component/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/zope/component/__pycache__/hooks.cpython-38.pyc

U

,�W��@sdZdZddlZddlZzddlmZWnek
rDdd�ZYnXddlmZddl	m
Z
dd	l	mZGd
d�de�Z
Gdd
�d
ej�Ze�Zddd�Zdd�Zejdd��Zddd�Zd dd�Zdd�Zdd�ZeZzddlmZWnek
�rYn
Xee�dS)!zEHooks for getting and setting a site in the thread global namespace.
Zrestructuredtext�N)�removeSecurityProxycCs|S�N�)�xrr�6/usr/lib/python3/dist-packages/zope/component/hooks.pyrsr)�getGlobalSiteManager)�ComponentLookupError)�IComponentLookupc@s eZdZdZdd�Zdd�ZdS)�
read_propertyz�Descriptor for property-like computed attributes.

    Unlike the standard 'property', this descriptor allows assigning a
    value to the instance, shadowing the property getter function.
    cCs
||_dSr��func)�selfrrrr�__init__&szread_property.__init__cCs|dkr|S|�|�Srr)r
�inst�clsrrr�__get__)szread_property.__get__N)�__name__�
__module__�__qualname__�__doc__rrrrrrr
 sr
c@s"eZdZdZe�Zedd��ZdS)�SiteInfoNcCs|jjj}||_|Sr)�smZadapters�adapter_hook)r
rrrrr3s
zSiteInfo.adapter_hook)rrr�siterrr
rrrrrr/srcCsN|dkrt�}nt|�}|��}|t_|t_zt`Wntk
rHYnXdSr)rr�getSiteManager�siteinforrr�AttributeError)rrrrr�setSite;s
rcCstjSr)rrrrrr�getSiteRsrccs(t�}t|�z
dVW5t|�XdSr)rr)rZold_siterrrrVs

rcCs&|dkrtjSt|t��}t|�}|S)z�A special hook for getting the site manager.

    Here we take the currently set site into account to find the appropriate
    site manager.
    N)rrr	rr)�contextrrrrr`s�r�cCs0zt�||||�WStk
r*|YSXdSr)rrr)Z	interface�object�name�defaultrrrrusrcCs(ddlm}|j�t�|j�t�dS�Nr��_api)�zope.componentr&rZsethookrr%rrr�setHooks|sr(cCsBddlm}|j��|j��zt`Wntk
r<YnXdSr$)r'r&r�resetrrrr%rrr�
resetHooks�s

r*)�
addCleanUp)N)N)r N)rZ
__docformat__�
contextlibZ	threadingZzope.security.proxyr�ImportErrorZzope.component.globalregistryrZzope.component.interfacesrr	r!r
Zlocalrrrr�contextmanagerrrrr(r*Z	clearSiteZzope.testing.cleanupr+rrrr�<module>s6