Spade

Mini Shell

Directory:~$ /proc/self/root/usr/lib/python2.7/site-packages/zope/component/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ //proc/self/root/usr/lib/python2.7/site-packages/zope/component/zcml.pyo

�
6j/Qc@sdZddlmZddlmZddlmZddlmZddlmZddlmZddl	m
Z
dd	lmZdd
lm
Z
ddlmZddlmZdd
lmZddlmZddlmZddlmZyddlmZWn2ek
r>d�ZeZZZZ
eZnAXddl!mZddl!mZddl!mZddl!m"Z"e
d�Z#de$efd��YZ%d�Z&defd��YZ'defd��YZ(d�Z)d5d5d5d
e+e+d!�Z,d"efd#��YZ-e&Z.d5d5d5d5d5e+e+d$�Z/d%e'fd&��YZ0d5d5d5d5d
d'�Z1d(efd)��YZ2d5d
d*�Z3d+efd,��YZ4d-efd.��YZ5d/e4e5fd0��YZ6d5d5d5ed1�Z7d2e'e5fd3��YZ8d5d5d5ed4�Z9d5S(6s.Component
Architecture configuration handlers
i����(tConfigurationError(tBool(tGlobalInterface(tGlobalObject(tPythonIdentifier(tTokens(tMessageFactory(t	Interface(t
implementedBy(t
providedBy(tTextLine(tgetSiteManager(t	adaptedBy(tprovideInterface(t_BLANK(t
PermissioncOstd��dS(NsTsecurity proxied components are not
supported because zope.security is not
available(R(targstkw((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyt_no_security$s(t_checker(tproxify(tprotectedFactory(tsecurityAdapterFactorytzopetComponentConfigurationErrorcBseZRS((t__name__t
__module__(((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyR1scOs#tt�|�}|||�dS(N(tgetattrR(t
methodNameRtkwargstmethod((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pythandler4stIBasicComponentInformationcBs}eZeded�ded�de�Zeded�ded�de�Zeded�ded�de�ZRS(	ttitlesComponent
to usetdescriptions�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.trequiredRs*Permission required
to use this component.tFactorys�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.(	RRRt_tFalset	componentRt
permissiontfactory(((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyR
8s		tIAdapterDirectivecBsFeZdZeded�ded�dede��Zeded�ded�de	�Z
eded	�ded
�de	dede���Ze
ded�ded
�de	�Zeded�ded�de	�Zeded�ded�de	de	�Zeded�ded�de	de	�ZRS(s
    Register an adapter
    R!sAdapter factory/factoriesR"sHA list of factories (usually just
one) that create the adapter instance.R#t
value_types Interface the component providessIThis attribute specifies the
interface the adapter instance must provide.sSpecifications to be
adapteds.This should be a list of interfaces or
classest
missing_valueRsEThis adapter is only available, if the principal
has this permission.tNamesYAdapters can have names.

This attribute allows you to specify the name for this
adapter.tTrustedsIMake 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.
        tdefaulttLocates�Make the adapter a locatable adapter

        Located adapter should be used if a non-public permission
        is used.
        (RRt__doc__RR%tTrueRR)RR&tprovidestobjecttfor_RR(R
tnameRttrustedtlocate(((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyR*SsH						cs
�fd�}�d|_|S(Ncs!x�D]}||�}qW|S(N((tobtf(t	factories(s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyR)�s
i(R)(R;R)((R;s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyt_rolledUpFactory�s
tcCsS|dkrOt|�dkr1t|d�}n|dkrOtd��qOnt|�}|dkr�t|�dkr�tt|d��}t|�dkr�|d}q�n|dkr�td��q�n|}	t|	�dkr�|	d}n`t|	�dkrtd��n?t|	�dkrHt|�dkrHtd��nt|	�}|dk	rut	|||�}n|s�|dk	s�|r�t
||||�}n|jdd|||fd	td
d|||||j
f�|jddd	td
d|f�|rOxB|D]7}
|
dk	r|jddd	td
d|
f�qqWndS(
NiisJNo for attribute was provided and can't
determine what the factory adapts.sMissing 'provides'
attributesNo factory specifieds-Can't use multiple factories and
multiple
fort
discriminatortadaptertcallableRtregisterAdapterR=(tNonetlenRt	TypeErrorttupletlistRRR<RRtactionRtinfoR
(t_contextR)R3R5R(R6R7R8tpR;tiface((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyR?�sT
$		

	tISubscriberDirectivecBs=eZdZeded�ded�de�Zeded�ded�de�Zeded�ded	�de�Z	e
ded
�ded�deded
e���Ze
ded�ded�de�Zeded�ded�dede�Zeded�ded�dede�ZRS(s
    Register a subscriber
    R!sSubscriber factoryR"s1A factory used to create the subscriber
instance.R#tHandlers&A callable object that handles events.s Interface
the component providessIThis attribute specifies the interface the adapter
instance must provide.s5Interfaces or classes that this subscriber depends
ons.This should be a list of interfaces or classesR+R,RsHThis subscriber
is only available, if the principal has this permission.R.sXMake 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/R0s�Make the subscriber a locatable subscriber

        Located subscribers should be used if a non-public permission
        is used.
       
(RRR1RR%R&R)RRR3RR4R5RR(RR7R8(((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyRL�sF							c	Cs�|dkrK|dkr'td��n|dk	rBtd��n|}n6|dk	rftd��n|dkr�td��n|dkr�t|�}|dkr�td��q�n|dk	r�t|||�}nt|�}|s�|dk	s�|rt||||�}n|dk	rQ|jdddtdd	||t|j	f�n1|jdddtdd
|||t|j	f�|dk	r�|jdddt
dd|f�nx?|D]7}|dk	r�|jdddt
dd|f�q�q�WdS(NsNo factory or handler provideds Cannot use
handler with providessCannot use handler with factorys@You must specify a
provided interface when registering a factorysWNo for attribute was
provided and can't determine what the factory (or handler)
adapts.R>R@RtregisterHandlertregisterSubscriptionAdapterR=(RBRDRRRERRGt_handlerRRHR
(	RIR5R)RR3R(R7R8RK((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyt
subscriber"sT				
	tIUtilityDirectivecBs\eZdZeded�ded�de�Zeded�ded�de�ZRS(sRegister
a utility.R!sProvided interfaceR"s"Interface provided by the
utility.R#R-sTName of the registration.  This is used by application code
when locating a utility.(	RRR1RR%R&R3R
R6(((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyRR`s	cCs|r|rtd��n|dkr�|rBtt|��}ntt|��}t|�dkrs|d}q�td��n|dk	r�t|d|d|�}n|jdd||fd	td
d||||j	fdt
d
|��|jddd	td
d|f�dS(Ns$Can't specify factory and component.iisMissing
'provides'
attributeR3R(R>tutilityR@RtregisterUtilityRR)R=(RDRBRFRR	RCRRGRRHtdictR
(RIR3R'R)R(R6((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyRSps(
		tIInterfaceDirectivecBs_eZdZeded�de�Zeded�de�Ze	ded�de�Z
RS(s
    Define an interface
    R!RR#sInterface typeR-(RRR1RR%R2t	interfaceR&ttypeR
R6(((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyRV�s		c	Cs)|jdddtd|||f�dS(NR>R@R(RGRBR
(RIRWRXR6((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyRW�s	tIBasicViewInformationcBs�eZdZeded�ded�dedede���Ze	ded�ded	�de
�Zeded
�ded�de
�Zeded�ded
�de
de
��Zeded�ded�de
de��ZRS(s,This is the basic information for all
views.R!s*Specifications of the objects to be viewedR"s7This should be
a list of interfaces or classes
        R#R+R,Rs&The permission needed to use the view.tClasss2A
class that provides attributes used by the view.s6Interface that is also
allowed if user has permission.s=
        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.sAView attributes that are also allowed if the user has
permission.s�
        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.(RRR1RR%R2RR4R5RR&R(tclass_Rtallowed_interfaceRtallowed_attributes(((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyRY�s8					tIBasicResourceInformationc	Bs�eZdZeded�ded�dede�Zeded�ded�de	de
�Zeded	�de�ZRS(
s)
    Basic information for resources
    R!sThe name of the resource.R"s3The name shows up in URLs/paths.
For example 'foo'.R#R/s&The interface this component
provides.si
        A view can provide an interface.  This would be used for
        views that support other views.sRequest type(
RRR1R
R%R2RR6RR&RR3RX(((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyR^�s			tIViewDirectivecBs2eZdZeded�dede��ZRS(sRegister
a view for a
componentR!R$R#R+(RRR1RR%R&RR)(((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyR_�s
c	s�|s|r"|r"td��n|dk	rst||||�}	dtfd��Y}
|
|d|	�|d<n|s�td��nt|�}|�t��dkr��d}npt��dkr�td��nOt��dkr
t|�dkr
td	��n�fd
�}�d|_||f}|jdd|||fd
tdd|||||j	f�|jddd
t
dd|f�|dk	r�xB|D]7}|dk	r�|jddd
t
dd|f�q�q�WndS(NsF'permission' required with
'allowed_interface' or
'allowed_attributes't	ProxyViewcBs
eZdZd�Zd�ZRS(s#Class to create simple proxy
views.cSs||_||_dS(N(R)tchecker(tselfR)Ra((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyt__init__s	cWst|j|�|j�S(N(RR)Ra(Rbtobjects((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyt__call__s(RRR1RcRe(((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyR`s	i����sNo
for interfaces specifiediisNo view factory specifieds-Can't use
multiple factories and multiple forcs2x�d
D]}||�}qW�d||�S(Ni����((R9trequestR:(R;(s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyR)-sR>tviewR@RRAR=(RRBRR4RERCR)RGRRHR
(RIR)RXR6R5R(R\R]R3RaR`RK((R;s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyRgsN	

$

		

	tIResourceDirectivecBsVeZdZeded�dede��Zeded�dede��Z	RS(sRegister
a resourceR!s6Interface that is also allowed if user has
permission.R#R+s=View attributes that are also allowed if user has
permission.(
RRR1RR%R&RR\RR](((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyRhLsc
Cs�|s|r"|r"td��n|dk	rdt||||�}||d�}	||	_|	}n|jdd|||fdtdd||f|||jf�|jdddtdd|f�|jdddtdd|f�dS(	NsDMust
use name attribute with allowed_interface or
allowed_attributescSst||�|�S(N(R(RfR)Ra((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyt
proxyResourcensR>tresourceR@RRAR=(RRBRR)RGRRHR
(
RIR)RXR6R(R\R]R3RaRi((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyRj]s.					
	N(:R1tzope.configuration.exceptionsRtzope.configuration.fieldsRRRRRtzope.i18nmessageidRtzope.interfaceRRR	tzope.schemaR
tzope.component._apiRtzope.component._declarationRtzope.component.interfaceR
tzope.component._compatRtzope.security.zcmlRtImportErrorRRRRtsecuritytzope.component.securityRR%t
ValueErrorRRR
R*R<RBR&R?RLRPRQRRRSRVRWRYR^R_RgRhRj(((s7/usr/lib/python2.7/site-packages/zope/component/zcml.pyt<module>sl
	
	E		<A=	3
H