mς ‘γΈEc@s-dZdkZdkZdkZdklZdklZl Z dk l Z dk Z dk lZlZlZdklZdklZdklZdkZeiiiiƒed „Zeiieiiƒeiieƒd „ƒƒZ d e i!fd „ƒYZ"d Z#ed„Z$ed„Z%dS(s]Five local component look-up support $Id: __init__.py 65813 2006-03-05 00:31:08Z philikon $ N(sIComponentLookup(sISites IPossibleSite(sBeforeTraverseEvent(saq_basesaq_inners aq_parent(s AccessRule(sregisterBeforeTraverse(sunregisterBeforeTraversecCsHxA|dj o3|i|ƒ o"t|dtt|ƒƒƒ}qW|S(sqFind a site by walking up the object hierarchy, supporting both the ``ILocation`` API and Zope 2 Acquisition.t __parent__N(tobjtNonetifacet providedBytgetattrt aq_parenttaq_inner(RR((t?/data/zmath/zope/lib/python/Products/Five/component/__init__.pytfindSite#s #cCs4t|ƒ}|djotiiƒSn|iƒS(sΞLook-up a site manager/component registry for local component lookup. This is registered in place of the one in Zope 3 so that we lookup using acquisition in addition to the ``ILocation`` API. N(R tobtsiteRtzopet componenttgetGlobalSiteManagertgetSiteManager(R R ((RtsiteManagerAdapter*s   t LocalSiteHookcBstZd„ZRS(NcCstiit||ƒƒdS(N(R teventtnotifytBeforeTraverseEventt containertrequest(tselfRR((Rt__call__8s(t__name__t __module__R(((RR6st__local_site_hook__cCs†t|ƒ}ti|ƒp td‚nttƒ}t||tdƒt |tƒpt |tt ƒƒnt i i||ƒdS(s4Install __before_traverse__ hook for Local Site sMust provide IPossibleSiteiN(taq_baseRt IPossibleSiteRt TypeErrort AccessRulet HOOK_NAMEthooktregisterBeforeTraversethasattrtsetattrRR t interfacet alsoProvidesR(RRR!((Rt enableSite=s   cCsqt|ƒ}|i|ƒptdƒ‚nt|tƒt|tƒot|tƒnt i i ||ƒdS(s3Remove __before_traverse__ hook for Local Site sObject must be a site.N( RRRRRtunregisterBeforeTraverseR R#tdelattrR R%tnoLongerProvides(RR((Rt disableSiteLs  (&t__doc__tzope.interfaceR tzope.componentt zope.eventtzope.component.interfacestIComponentLookuptzope.app.component.interfacestISiteRt$zope.app.publication.zopepublicationRtExtensionClasst AcquisitionRRRtProducts.SiteAccess.AccessRuleRtZPublisher.BeforeTraverseR"R(tzope.app.component.hookstappR thookstsetHooksR tadapterR%t Interfacet implementerRtBaseRR R'R+(R(RR5RRR RRR"R1RR3R R R+R'RR((Rt?s&           3