mò .á¸Ec@sYdZdkZdkZdklZdkZdklZdklZdkl Z l Z l Z l Z l Z dklZdklZdklZd klZd klZd ZeZd Zed ƒZd„Zd„Zd„Zd„Zd„Zdadfd„ƒYZ ee ƒd„Z!d fd„ƒYZ"dfd„ƒYZ#ee#ƒdS(sdCacheable object and cache management base classes. $Id: Cache.py 65833 2006-03-06 15:31:58Z shh $ N(s getLogger(sInitializeClass(sDTMLFile(saq_gets aq_acquiresaq_inners aq_parentsaq_base(sClassSecurityInfo(sgetSecurityManager(s_isBeingUsedAsAMethod(s Unauthorized(sview_management_screenst__ZCacheManager_ids__sChange cache settingstCachecCstt|ƒddƒS(Nt _isCacheablei(tgetattrtaq_basetob(R((t(/data/zmath/zope/lib/python/OFS/Cache.pyt isCacheable%scCs"t|tddƒodSndS(Nii(taq_getRt ZCM_MANAGERStNone(R((Rt managersExist(scCs;t|ƒo tt|ƒƒ}t|ƒSn t|ƒSdS(N(t_isBeingUsedAsAMethodRt aq_parenttaq_innertparentRR (RR((RtfilterCacheTab.s cCs8tt|ƒtƒo|t|tƒjodSndS(s‡ This is a filter method for aq_acquire. It causes objects to be found only if they are in the list of cache managers. iiN(thasattrRt containerR tnameR(torigRRtvaluetextra((RtfilterCacheManagers6s,cCsct|tfƒ}g}x>|D]6}tt||dƒddƒo|i|ƒqqWt|ƒS(sM Gets the list of cache managers in a container, verifying each one. t_isCacheManageriN( RRR tidstrvaltidR tappendttuple(RRRR((RtgetVerifiedManagerIdsAsit CacheablecBs6tZdZhdd<dd<de<dd.RiN(RR*Rtused_idsR RRR RRRR4R<thas_keyR]RR RR(R*R]R4RRRRR^((RR\"s(     tZCacheable_setManagerIdcCsj|iƒ|p d}n t|ƒ}||_d|_|dj o |i||ddddƒSndS(s'Changes the manager_id for this object.RKRRLsCache settings changed.N( R*RJR,R tstrR+R0RPR"(R*R,RP((RR`9s      tZCacheable_enabledcCs|iS(sEReturns true if caching is enabled for this object or method.N(R*R7(R*((RRbKstZCacheable_setEnabledcCsH|odpd|_|dj o |i||ddddƒSndS(s^Changes the enabled flag. Normally used only when setting up cacheable ZClass methods.iiRKRRLsCache settings changed.N(tenabledR*R7RPR R"(R*RdRP((RRcRs  tZCacheable_configHTMLcCsdS(syOverride to provide configuration of caching behavior that can only be specific to the cacheable object. R>N((R*((RRe]s(R%sCacheable-properties.stx(R&(%t__name__t __module__t__doc__Rtmanage_optionstClassSecurityInfotsecuritytsetPermissionDefaulttChangeCacheSettingsPermissiontdeclareProtectedtViewManagementScreensPermissiontDTMLFiletglobalsR"R R0R2R+R7RtdeclarePrivateR'R/R6R8R:R=RGRJRQRYRZR\R`RbRcRe(((RRSsj -                            c CsÔy³|o|i|ƒ} n |iƒ} tƒ} xê| D]â} t| ƒpq9n| iƒ|j} |o| oq9n| i d| ƒpq9n|| iƒf} tt| ƒddƒ}hd| <ddi| ƒ<dtt| ƒddƒ<d|<d| <}|i|ƒq9W|oŒ|o|iƒ} nxr| D]f} || iƒf} tt| ƒd ƒo7| i d | ƒo t| |||||| ƒqªqDqDWnWnd k}|iƒnXd S( s‰ Used by the CacheManager UI. Recursive. Similar to the Zope "Find" function. Finds all Cacheable objects in a hierarchy. sChange cache settingsticonR>tsortkeytpatht/R]t associatedt objectValuessAccess contents informationN(t meta_typesRRxtsubobstgetSecurityManagertsmtsubobRRYR,Rwt require_assoctcheckPermissionRuR<tsubpathRRRstjointinfoRRt subfoldersRtfindCacheablest tracebackt print_exc(RR,R~RƒRyRRuR‚R…RzR€R}R|RwRs((RR„gs@   N $ cBs)tZdZd„Zd„Zd„ZRS(s‘ A base class (and interface description) for caches. Note that Cache objects are not intended to be visible by restricted code. cCs t‚dS(N(tNotImplementedError(R*R((RRM scCs t‚dS(N(R‡(R*RR;RARBR)((RR@£scCs t‚dS(N(R‡(R*RRIR;RARB((RRH¶s(RfRgRhRMR@RH(((RR™s   t CacheManagercBsÙtZdZeƒZeiedƒeidƒd„ZdZ hdd<dd<d dás( RR*R‹RRRR<RRŒR R#RR3(R*R‹RRR((Rtmanage_beforeDeleteÚs   s dtml/cmassoctZCacheManager_locatec Cs’tt|ƒƒ}g}|iƒ}d|jo g}nt||||||fƒ|dj o&|i ||ddd|ddƒSn|SdS(s#Locates cacheable objects. R>t show_resultsitresultsRKR‰N(R RR*RRR<R,RyR„R~RƒRPR RŠ(R*R~RƒRyRPRRR,((RR’ës     tZCacheManager_setAssociationsc Cswd} d}tt|ƒƒ}tƒ} t|i ƒƒ}|d jo |i}nxæ|iƒD]Ø\}}|d djo»|d} |i| ƒ}| id|ƒp t‚nt|ƒpq`nt|iƒƒ} |o,| |jo|i|ƒ| d} q4q8| |jo|id ƒ|d}q8q`q`W|d j o*|i||dddd | |fƒSnd S( sXAssociates and un-associates cacheable objects with this cache manager. ii t associate_sChange cache settingsiRKR‰RLs#%d association(s) made, %d removed.N(taddcounttremcountR RR*RR{R|RaR<tmy_idtpropsR RPtformtitemstkeyt do_associateRutrestrictedTraverseRRt UnauthorizedRRYR,R`RŠ( R*RšRPRRR˜RR™RžR,R|RuR—((RR•s8            (sManager(sOFSPsCacheManager-associate.stx(RfRgRhRjRkRlRmRrR5RRiRŽR‘RnRpRqRŠR R’R•(((RRˆ»s$    $   ($RhRRFtloggingt getLoggertGlobalstInitializeClassRpt AcquisitionRR-RR Rt AccessControlRjR{tAccessControl.RoleR R tAccessControl.Permissionstview_management_screensR RoRmRDRR RRRR3RR„RRˆ(RRDRoR-RˆR R RRR RR©RRR RjRRpR¤RFRRmR„R R{RR¢R£R((Rt?s8    %          ÿ  2"i