ok

Mini Shell

Direktori : /lib/python3.6/site-packages/zope/component/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/zope/component/__pycache__/zcml.cpython-36.pyc

3

,�W�O�@s@dZddlmZddlmZddlmZddlmZddlmZddlmZddl	m
Z
dd	lmZdd
lm
Z
ddlmZddlmZdd
lmZddlmZmZddlmZddlmZyddlmZWn0ek
r�dd�ZeZZZ Z!eZYn2Xddl"mZddl"mZddl"m Z ddl"m#Z#e
d�Z$Gdd�de%e�Z&dd�Z'Gdd�de�Z(Gdd �d e�Z)d!d"�Z*d@d&d'�Z+Gd(d)�d)e�Z,e'Z-dAd*d+�Z.Gd,d-�d-e(�Z/dBd.d/�Z0Gd0d1�d1e�Z1dCd2d3�Z2Gd4d5�d5e�Z3Gd6d7�d7e�Z4Gd8d9�d9e3e4�Z5d#d#d#efd:d;�Z6Gd<d=�d=e(e4�Z7d#d#d#efd>d?�Z8d#S)Dz.Component Architecture configuration handlers
�)�ConfigurationError)�Bool)�GlobalInterface)�GlobalObject)�PythonIdentifier)�Tokens)�MessageFactory)�	Interface)�
implementedBy)�
providedBy)�TextLine)�getSiteManager)�	adaptedBy�getName)�provideInterface)�_BLANK)�
PermissioncOstd��dS)NzTsecurity proxied components are not supported because zope.security is not available)r)�args�kw�r�/usr/lib/python3.6/zcml.py�_no_security$sr)�_checker)�proxify)�protectedFactory)�securityAdapterFactoryZzopec@seZdZdS)�ComponentConfigurationErrorN)�__name__�
__module__�__qualname__rrrrr1srcOstt�|�}|||�dS)N)�getattrr
)Z
methodNamer�kwargs�methodrrr�handler4sr#c@sNeZdZeed�ed�dd�Zeed�ed�dd�Zeed�ed�dd�Zd	S)
�IBasicComponentInformationzComponent to usez�Python name of the implementation object.  This must identify an object in a module using the full dotted name.  If specified, the ``factory`` field must be left blank.F)�title�description�requiredrz*Permission required to use this component.�Factoryz�Python name of a factory which can create the implementation object.  This must identify an object in a module using the full dotted name. If specified, the ``component`` field must be left blank.N)	rrrr�_�	componentr�
permission�factoryrrrrr$8sr$c@s�eZdZdZeed�ed�de�d�Zeed�ed�dd	�Z	eed
�ed�dee
�d�d�Zeed
�ed�dd	�Z
eed�ed�dd	�Zeed�ed�ddd�Zeed�ed�ddd�ZdS)�IAdapterDirectivez
    Register an adapter
    zAdapter factory/factorieszHA list of factories (usually just one) that create the adapter instance.T)r%r&r'�
value_typez Interface the component provideszIThis attribute specifies the interface the adapter instance must provide.F)r%r&r'zSpecifications to be adaptedz.This should be a list of interfaces or classes)�
missing_valuerzEThis adapter is only available, if the principal has this permission.�NamezYAdapters can have names.

This attribute allows you to specify the name for this adapter.�TrustedaIMake the adapter a trusted adapter

        Trusted adapters have unfettered access to the objects they
        adapt.  If asked to adapt security-proxied objects, then,
        rather than getting an unproxied adapter of security-proxied
        objects, you get a security-proxied adapter of unproxied
        objects.
        )r%r&r'�default�Locatez�Make the adapter a locatable adapter

        Located adapter should be used if a non-public permission
        is used.
        N)rrr�__doc__rr)rr,r�provides�object�for_rr+r�namer�trusted�locaterrrrr-SsH
r-cs�fdd�}�d|_|S)Ncsx�D]}||�}qW|S)Nr)�ob�f)�	factoriesrrr,�s
z!_rolledUpFactory.<locals>.factoryr)r,)r=r,r)r=r�_rolledUpFactory�s
r>N�Fc	Cs�|dkr0t|�dkr t|d�}|dkr0td��t|�}|dkr�t|�dkrptt|d��}t|�dkrp|d}|dkr�td��|dkr�t|�dkr�t|d�}|}	t|	�dkr�|	d}n@t|	�dkr�td��n*t|	�dkr�t|�dkr�td��nt|	�}|dk	�rt	|||�}|�s&|dk	�s&|�r4t
||||�}|jd|||ftd	|||||j
fd
�|jdtd|fd
�|�r�x,|D]$}
|
dk	�rz|jdtd|
fd
��qzWdS)N�rzJNo for attribute was provided and can't determine what the factory adapts.zMissing 'provides' attributer?zNo factory specifiedz-Can't use multiple factories and multiple for�adapter�registerAdapter)�
discriminator�callabler)�lenr�	TypeError�tuple�listr
rrr>rr�actionr#�infor)�_contextr,r5r7r+r8r9r:�pr=�ifacerrrrA�sZ





rAc@s�eZdZdZeed�ed�dd�Zeed�ed�dd�Zeed�ed	�dd�Z	e
ed
�ed�dee�d�d
�Ze
ed�ed�dd�Zeed�ed�ddd�Zeed�ed�ddd�ZdS)�ISubscriberDirectivez
    Register a subscriber
    zSubscriber factoryz1A factory used to create the subscriber instance.F)r%r&r'ZHandlerz&A callable object that handles events.z Interface the component provideszIThis attribute specifies the interface the adapter instance must provide.z5Interfaces or classes that this subscriber depends onz.This should be a list of interfaces or classes)r/)r%r&r'r.rzHThis subscriber is only available, if the principal has this permission.r1aXMake the subscriber a trusted subscriber

        Trusted subscribers have unfettered access to the objects they
        adapt.  If asked to adapt security-proxied objects, then,
        rather than getting an unproxied subscriber of security-proxied
        objects, you get a security-proxied subscriber of unproxied
        objects.
        )r%r&r'r2r3z�Make the subscriber a locatable subscriber

        Located subscribers should be used if a non-public permission
        is used.
        N)rrrr4rr)r,r#rr5rr6r7rr+rr9r:rrrrrN�sFrNc		Cs<|dkr.|dkrtd��|dk	r(td��|}n |dk	r>td��|dkrNtd��|dkrnt|�}|dkrntd��|dk	r�t|||�}t|�}|s�|dk	s�|r�t||||�}|dk	r�|jdtd||t|jfd�n|jdtd|||t|jfd�|dk	�r
|jdt	d	|fd�x,|D]$}|dk	�r|jdt	d	|fd��qWdS)
NzNo factory or handler providedz Cannot use handler with provideszCannot use handler with factoryz@You must specify a provided interface when registering a factoryzWNo for attribute was provided and can't determine what the factory (or handler) adapts.ZregisterHandler)rCrDrZregisterSubscriptionAdapterr?)
rFrrrGrrI�_handlerrrJr)	rKr7r,r#r5r+r9r:rMrrr�
subscriber&sT


rPc@s<eZdZdZeed�ed�dd�Zeed�ed�dd�ZdS)	�IUtilityDirectivezRegister a utility.zProvided interfacez"Interface provided by the utility.F)r%r&r'r0zTName of the registration.  This is used by application code when locating a utility.N)	rrrr4rr)r5rr8rrrrrQdsrQcCs�|r|rtd��|dkrT|r*tt|��}ntt|��}t|�dkrL|d}ntd��|dkrr|rjt|�}nt|�}|dk	r�t|||d�}|jd||ftd||||j	ft
|d	�d
�|jdtd|fd�dS)Nz$Can't specify factory and component.r@rzMissing 'provides' attributer?)r5r+�utilityZregisterUtility)r,)rCrDrr)rCrDr)rFrHr
rrErrrIr#rJ�dictr)rKr5r*r,r+r8rrrrRts0

rRc@s@eZdZdZeed�dd�Zeed�dd�Zeed�dd�Z	dS)	�IInterfaceDirectivez
    Define an interface
    r	T)r%r'zInterface typeFr0N)
rrrr4rr)�	interface�typerr8rrrrrT�srTcCs|jdt|||fd�dS)N)rCrDr)rIr)rKrUrVr8rrrrU�srUc@s�eZdZdZeed�ed�dee�d�d�Ze	ed�ed�d	d
�Z
eed�ed�d	d
�Zeed
�ed�d	e�d�Z
eed�ed�d	e�d�ZdS)�IBasicViewInformationz,This is the basic information for all views.z*Specifications of the objects to be viewedz7This should be a list of interfaces or classes
        T)r/)r%r&r'r.rz&The permission needed to use the view.F)r%r&r'ZClassz2A class that provides attributes used by the view.z6Interface that is also allowed if user has permission.a=
        By default, 'permission' only applies to viewing the view and
        any possible sub views. By specifying this attribute, you can
        make the permission also apply to everything described in the
        supplied interface.

        Multiple interfaces can be provided, separated by
        whitespace.zAView attributes that are also allowed if the user has permission.z�
        By default, 'permission' only applies to viewing the view and
        any possible sub views. By specifying 'allowed_attributes',
        you can make the permission also apply to the extra attributes
        on the view object.N)rrrr4rr)rr6r7rr+Zclass_r�allowed_interfacer�allowed_attributesrrrrrW�s8
rWc@sPeZdZdZeed�ed�ded�Zeed�ed�de	d�Z
eed	�dd
�ZdS)�IBasicResourceInformationz)
    Basic information for resources
    zThe name of the resource.z3The name shows up in URLs/paths. For example 'foo'.T)r%r&r'r2z&The interface this component provides.zi
        A view can provide an interface.  This would be used for
        views that support other views.FzRequest type)r%r'N)rrrr4rr)rr8rr	r5rVrrrrrZ�srZc@s$eZdZdZeed�de�d�ZdS)�IViewDirectivezRegister a view for a componentr(F)r%r'r.N)rrrr4rr)rr,rrrrr[s
r[c		sJ|s|r|rtd��|dk	rNt||||�}	Gdd�dt�}
|
|d|	�|d<|sZtd��t|�}|�t��dkr|�d}nNt��dkr�td��n8t��dkr�t|�dkr�td��n�fd	d
�}�d|_||f}|jd|||ftd|||||jfd
�|jdt	d|fd
�|dk	�rFx,|D]$}|dk	�r|jdt	d|fd
��qWdS)NzF'permission' required with 'allowed_interface' or 'allowed_attributes'c@s eZdZdZdd�Zdd�ZdS)zview.<locals>.ProxyViewz#Class to create simple proxy views.cSs||_||_dS)N)r,�checker)�selfr,r\rrr�__init__sz view.<locals>.ProxyView.__init__cWst|j|�|j�S)N)rr,r\)r]Zobjectsrrr�__call__#sz view.<locals>.ProxyView.__call__N)rrrr4r^r_rrrr�	ProxyViewsr`r@zNo for interfaces specifiedrzNo view factory specifiedz-Can't use multiple factories and multiple forcs,x�dd�D]}||�}qW�d||�S)Nr@���rar)r;�requestr<)r=rrr,7szview.<locals>.factory�viewrB)rCrDrr?rara)
rrr6rGrEr,rIr#rJr)rKr,rVr8r7r+rXrYr5r\r`rMr)r=rrc
sN








rcc@s8eZdZdZeed�de�d�Zeed�de�d�Z	dS)�IResourceDirectivezRegister a resourcez6Interface that is also allowed if user has permission.F)r%r'r.z=View attributes that are also allowed if user has permission.N)
rrrr4rr)rrXrrYrrrrrdVs
rdc
	Cs�|s|r|rtd��|dk	rDt||||�}||fdd�}	||	_|	}|jd|||ftd||f|||jfd�|jdtd|fd�|jdtd|fd�dS)NzDMust use name attribute with allowed_interface or allowed_attributescSst||�|�S)N)r)rbr,r\rrr�
proxyResourcexszresource.<locals>.proxyResource�resourcerB)rCrDrr?)rrr,rIr#rJr)
rKr,rVr8r+rXrYr5r\rerrrrfgs.
rf)NNNr?FF)NNNNNFF)NNNNr?)Nr?)9r4Zzope.configuration.exceptionsrZzope.configuration.fieldsrrrrrZzope.i18nmessageidrZzope.interfacer	r
rZzope.schemarZzope.component._apir
Zzope.component._declarationrrZzope.component.interfacerZzope.component._compatrZzope.security.zcmlr�ImportErrorrrrrZsecurityZzope.component.securityrr)�
ValueErrorrr#r$r-r>rArNrOrPrQrRrTrUrWrZr[rcrdrfrrrr�<module>sl
E
@A
=
#
3
H

Zerion Mini Shell 1.0