ó úŠ/Qc@s dZyddlmZWnek r6d„ZnXddlmZddlmZddlmZddlmZddlm Z dd lm Z dd lm Z dd lm Z dd lm Z dd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZeeƒdefd„ƒYƒZd„Zd„Zd„Zee ƒdefd„ƒYƒZ eeƒdefd„ƒYƒZ!ee ƒde!fd „ƒYƒZ"ee ƒd!e!fd"„ƒYƒZ#d#S($sBasic components support iÿÿÿÿ(tnotifycOsdS(N((targtkw((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyRs(tISpecification(tComponentLookupError(tIAdapterRegistration(t IComponents(tIHandlerRegistration(t ISubscriptionAdapterRegistration(tIUtilityRegistration(t Registered(t Unregistered(t Interface(t implementedBy(t implementer(timplementer_only(t providedBy(tAdapterRegistry(t_u(t CLASS_TYPES(t STRING_TYPESt ComponentscBseZdd d„Zd„Zd„Zd„Zd„Zd„Zed„d„ƒZ d!d!e dƒe dƒe d!d „Z d!d!e dƒd!d „Zd „Ze dƒd!d „Ze dƒd „Zd„Zd„Zd!d!e dƒe dƒe d„Zd!d!d!e dƒd„Zd„Ze dƒd!d„Ze dƒd„Ze dƒd!d„Ze dƒd„Zd„Zd!d!e dƒe dƒe d„Zd„Zd!d!d!e dƒd„Zd„Zd!e dƒe dƒe d„Z d„Z!d!d!e dƒd„Z"d„Z#RS("tcCsEt|tƒst‚||_|jƒ|jƒt|ƒ|_dS(N(t isinstanceRtAssertionErrort__name__t_init_registriest_init_registrationsttuplet __bases__(tselftnametbases((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyt__init__-s    cCsd|jj|jfS(Ns<%s %s>(t __class__R(R((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyt__repr__4scCstƒ|_tƒ|_dS(N(Rtadapterst utilities(R((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR7s cCs(i|_i|_g|_g|_dS(N(t_utility_registrationst_adapter_registrationst_subscription_registrationst_handler_registrations(R((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR;s   cCs|jjddƒS(NR((t__dict__tget(R((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyt _getBasesAscCsgtg|D]}|j^q ƒ|j_tg|D]}|j^q2ƒ|j_t|ƒ|jdNscCs |j|ƒS(N(R.(RR ((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR/Osc Csx|r'|rtdƒ‚n|ƒ}n|dkrBt|ƒ}n|jj||fƒ}|dk rš|d ||fkr€dS|j|d||ƒnt}xOt|jjƒƒD]8\\} } } | |kr¶| d|kr¶t }Pq¶q¶W|||f|j||f<|j j d|||ƒ|sF|j j d||ƒn|rtt tt||||||ƒƒƒndS(Ns$Can't specify factory and component.ii(((t TypeErrortNonet_getUtilityProvidedR&R+tunregisterUtilitytFalsetitertitemstTrueR%tregistert subscribeRR tUtilityRegistration( Rt componenttprovidedRtinfoteventtfactorytregt subscribedtpt_tdata((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pytregisterUtilityRs0   (c Cs|r'|rtdƒ‚n|ƒ}n|dkr]|dkrNtdƒ‚nt|ƒ}n|jj||fƒ}|dks|dk r¡||dkr¡tS|dkrº|d}n|j||f=|jjd||ƒt}xOt|jj ƒƒD]8\\}}} ||krü| d|krüt }PqüqüW|sW|jj d||ƒnt t t|||||dŒƒƒt S(Ns$Can't specify factory and component.s3Must specify one of component, factory and providedii(((R0R1R2R&R+R4R%t unregisterR5R6R7t unsubscribeRR R:( RR;R<RR?toldRARBRCRD((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR3us4     ( ccsDx=t|jjƒƒD]&\\}}}t||||ŒVqWdS(N(R5R&R6R:(RR<RRD((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pytregisteredUtilitiesžs%cCs|jjd|||ƒS(N((R%tlookup(RR<Rtdefault((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyt queryUtility£scCs:|jjd||ƒ}|dkr6t||ƒ‚n|S(N((R%RJR1R(RR<Rtutility((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyt getUtility¦s ccs5x.|jjd|ƒD]\}}||fVqWdS(N((R%t lookupAll(Rt interfaceRRM((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pytgetUtilitiesFor¬s"cCs|jjd|ƒS(N((R%t subscriptions(RRP((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pytgetAllUtilitiesRegisteredFor°sc Cs‘|dkrt|ƒ}nt||ƒ}||f|j|||f<|jj||||ƒ|rttt||||||ƒƒƒndS(N( R1t_getAdapterProvidedt_getAdapterRequiredR'R$R8RR tAdapterRegistration(RR?trequiredR<RR=R>((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pytregisterAdapter³s c Cs|dkr6|dkr'tdƒ‚nt|ƒ}n|dkr]|dkr]tdƒ‚nt||ƒ}|jj|||fƒ}|dks¯|dk r³||dkr³tS|j|||f=|jj|||ƒt t t |||||Œƒƒt S(Ns(Must specify one of factory and provideds(Must specify one of factory and requiredi( R1R0RTRUR'R+R4R$RFRR RVR7(RR?RWR<RRH((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pytunregisterAdapterÃs"   ccsSxLt|jjƒƒD]5\\}}}\}}t||||||ƒVqWdS(N(R5R'R6RV(RRWR<RR;R=((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pytregisteredAdaptersÞs.cCs|jj||||ƒS(N(R$t queryAdapter(RtobjectRPRRK((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR[äscCs=|jj|||ƒ}|dkr9t|||ƒ‚n|S(N(R$R[R1R(RR\RPRtadapter((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyt getAdapterçs cCs|jj||||ƒS(N(R$tqueryMultiAdapter(RtobjectsRPRRK((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR_ís cCs=|jj|||ƒ}|dkr9t|||ƒ‚n|S(N(R$R_R1R(RR`RPRR]((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pytgetMultiAdapteròs ccs_xX|jjttt|ƒƒ|ƒD]2\}}||Œ}|dk r%||fVq%q%WdS(N(R$ROtlisttmapRR1(RR`R<RR?R]((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyt getAdaptersøs    c Cs¦|rtdƒ‚n|dkr0t|ƒ}nt||ƒ}|jj|||||fƒ|jj|||ƒ|r¢tt t ||||||ƒƒƒndS(Ns'Named subscribers are not yet supported( R0R1RTRUR(tappendR$R9RR tSubscriptionRegistration(RR?RWR<RR=R>((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pytregisterSubscriptionAdapters  ccs&x|jD]}t||ŒVq WdS(N(R(Rf(RRD((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pytregisteredSubscriptionAdapterssc Cs¨|rtdƒ‚n|dkrK|dkr<tdƒ‚nt|ƒ}n|dkrr|dkrrtdƒ‚nt||ƒ}|dkrâg|jD]B\}}}}} ||koÁ||ks—||||| f^q—} n^g|jD]N\}}}}} ||ko"||ko"||ksì||||| f^qì} t| ƒt|jƒkr_tS| |j(|jj|||ƒt t t |||||dƒƒƒt S(Ns'Named subscribers are not yet supporteds(Must specify one of factory and provideds(Must specify one of factory and requiredR( R0R1RTRUR(tlenR4R$RGRR RfR7( RR?RWR<RtrRBtntftitnew((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pytunregisterSubscriptionAdapters0   6? cCs|jj||ƒS(N(R$t subscribers(RR`R<((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyRpBscCs…|rtdƒ‚nt||ƒ}|jj||||fƒ|jj|d|ƒ|rttt |||||ƒƒƒndS(Ns$Named handlers are not yet supported( R0RUR)ReR$R9R1RR tHandlerRegistration(RR?RWRR=R>((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pytregisterHandlerEs ccs&x|jD]}t||ŒVq WdS(N(R)Rq(RRD((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pytregisteredHandlersVsc CsK|rtdƒ‚n|dkr<|dkr<tdƒ‚nt||ƒ}|dkršg|jD]0\}}}}||kra||||f^qa}nLg|jD]<\}}}}||koË||ks¤||||f^q¤}t|ƒt|jƒkrtS||j(|jj|d|ƒtt t ||||dƒƒƒt S(Ns'Named subscribers are not yet supporteds(Must specify one of factory and requiredR( R0R1RUR)RiR4R$RGRR RqR7( RR?RWRRjRkRlRmRn((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pytunregisterHandlerZs& '0 cGs|jj|dƒdS(N(R$RpR1(RR`((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pythandle|s(N($Rt __module__R!R#RRR,R.tpropertyRR1RR7RER3RIRLRNRQRSRXRYRZR[R^R_RaRdRgRhRoRpRrRsRtRu(((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR*sT      " (         )   "cCs<tt|ƒƒ}t|ƒdkr,|dStdƒ‚dS(NiisWThe utility doesn't provide a single interface and no provided interface was specified.(RbRRiR0(R;R<((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR2€s cCs<tt|ƒƒ}t|ƒdkr,|dStdƒ‚dS(NiisaThe adapter factory doesn't implement a single interface and no provided interface was specified.(RbR RiR0(R?R<((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyRTˆs cCsÙ|dkr<y |j}WqZtk r8tdƒ‚qZXntj|ƒrZtdƒ‚ng}xl|D]d}|dkr‚t}n<tj|ƒs¾t|tƒr¯t |ƒ}q¾tdƒ‚n|j |ƒqgWt |ƒS(NsoThe adapter factory doesn't have a __component_adapts__ attribute and no required specifications were specifiedsLthe required argument should be a list of interfaces, not a single interfaces8Required specification must be a specification or class.( R1t__component_adapts__tAttributeErrorR0RRR RRR ReR(R?RWtresultRj((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyRUs$      R:cBs\eZd d„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d„Z RS( cCs@||||||f\|_|_|_|_|_|_dS(N(tregistryR<RR;R=R?(RR{R<RR;tdocR?((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR!¯sc CsVd|jj|jt|jddƒ|jt|jdt|jƒƒ|j |j fS(Ns%s(%r, %s, %r, %s, %r, %r)R( R"RR{tgetattrR<R1RR;treprR?R=(R((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR#´s  cCs t|ƒS(N(tid(R((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyt__hash__½scCst|ƒt|ƒkS(N(R~(Rtother((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyt__eq__ÀscCst|ƒt|ƒkS(N(R~(RR((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyt__ne__ÃscCst|ƒt|ƒkS(N(R~(RR((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyt__lt__ÆscCst|ƒt|ƒkS(N(R~(RR((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyt__le__ÉscCst|ƒt|ƒkS(N(R~(RR((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyt__gt__ÌscCst|ƒt|ƒkS(N(R~(RR((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyt__ge__ÏsN( RRvR1R!R#R€R‚RƒR„R…R†R‡(((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR:¬s       RVcBsYeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z RS( cCs@||||||f\|_|_|_|_|_|_dS(N(R{RWR<RR?R=(RR{RWR<RR;R|((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR!Õsc Cs}d|jj|jddjg|jD]}|j^q%ƒdt|jddƒ|jt|j dt |j ƒƒ|j fS(Ns%s(%r, %s, %s, %r, %s, %r)t[s, t]R( R"RR{tjoinRWR}R<R1RR?R~R=(RRj((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR#Ús  -cCs t|ƒS(N(R(R((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR€ãscCst|ƒt|ƒkS(N(R~(RR((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR‚æscCst|ƒt|ƒkS(N(R~(RR((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyRƒéscCst|ƒt|ƒkS(N(R~(RR((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR„ìscCst|ƒt|ƒkS(N(R~(RR((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR…ïscCst|ƒt|ƒkS(N(R~(RR((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR†òscCst|ƒt|ƒkS(N(R~(RR((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR‡õs( RRvR!R#R€R‚RƒR„R…R†R‡(((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyRVÒs       RfcBseZRS((RRv(((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyRføsRqcBs/eZd„Zed„ƒZdZd„ZRS(cCs7|||||f\|_|_|_|_|_dS(N(R{RWRthandlerR=(RR{RWRR‹R|((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR!scCs|jS(N(R‹(R((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR?sc Cskd|jj|jddjg|jD]}|j^q%ƒd|jt|jdt|jƒƒ|j fS(Ns%s(%r, %s, %r, %s, %r)Rˆs, R‰R( R"RR{RŠRWRR}R?R~R=(RRj((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyR# s  -N(RRvR!RwR?R1R<R#(((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pyRqýs N($t__doc__t zope.eventRt ImportErrortzope.interface.interfacesRRRRRRR R R tzope.interface.interfaceR tzope.interface.declarationsR RRRtzope.interface.adapterRtzope.interface._compatRRRR\RR2RTRUR:RVRfRq(((s;/usr/lib/python2.7/dist-packages/zope/interface/registry.pytsH   ÿV    % %