Back to index

plone3  3.1.7
Classes | Functions | Variables
CMFCore.CachingPolicyManager Namespace Reference

Classes

class  CPMCache
class  CachingPolicy
class  CachingPolicyManager

Functions

def createCPContext
def handleCachingPolicyManagerEvent
def manage_addCachingPolicyManager

Variables

tuple VIEW_METATYPES

Function Documentation

def CMFCore.CachingPolicyManager.createCPContext (   content,
  view_method,
  keywords,
  time = None 
)
    Construct an expression context for TALES expressions,
    for use by CachingPolicy objects.

Definition at line 60 of file CachingPolicyManager.py.

00060 
00061 def createCPContext( content, view_method, keywords, time=None ):
00062     """
00063         Construct an expression context for TALES expressions,
00064         for use by CachingPolicy objects.
00065     """
00066     pm = getToolByName( content, 'portal_membership', None )
00067     if not pm or pm.isAnonymousUser():
00068         member = None
00069     else:
00070         member = pm.getAuthenticatedMember()
00071 
00072     if time is None:
00073         time = DateTime()
00074 
00075     # The name "content" is deprecated and will go away in CMF 2.0,
00076     # please use "object" in your policy
00077     data = { 'content'  : content
00078            , 'object'   : content
00079            , 'view'     : view_method
00080            , 'keywords' : keywords
00081            , 'request'  : getattr( content, 'REQUEST', {} )
00082            , 'member'   : member
00083            , 'modules'  : SecureModuleImporter
00084            , 'nothing'  : None
00085            , 'time'     : time
00086            }
00087 
00088     return getEngine().getContext( data )

Here is the call graph for this function:

Here is the caller graph for this function:

Event subscriber for (un)registering a CPM as CacheManager

Definition at line 887 of file CachingPolicyManager.py.

00887 
00888 def handleCachingPolicyManagerEvent(ob, event):
00889     """ Event subscriber for (un)registering a CPM as CacheManager
00890     """
00891     if not ICachingPolicyManager.providedBy(ob):
00892         return
00893 
00894     if IObjectMovedEvent.providedBy(event):
00895         if event.newParent is not None:
00896             ids = getVerifiedManagerIds(event.newParent)
00897             id = ob.getId()
00898             if id not in ids:
00899                 setattr(event.newParent, ZCM_MANAGERS, ids + (id,))
00900 
00901     elif IObjectWillBeMovedEvent.providedBy(event):
00902         if event.oldParent is not None:
00903             ids = list(getVerifiedManagerIds(event.oldParent))
00904             id = ob.getId()
00905             if id in ids:
00906                 ids.remove(id)
00907                 setattr(event.oldParent, ZCM_MANAGERS, tuple(ids))
00908 

    Add a CPM to self.

Definition at line 909 of file CachingPolicyManager.py.

00909 
00910 def manage_addCachingPolicyManager( self, REQUEST=None ):
00911     """
00912         Add a CPM to self.
00913     """
00914     id = CachingPolicyManager.id
00915     mgr = CachingPolicyManager()
00916     self._setObject( id, mgr )
00917 
00918     if REQUEST is not None:
00919         REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
00920                       + '/manage_main'
00921                       + '?manage_tabs_message=Caching+Policy+Manager+added.'
00922                       )

Variable Documentation

Initial value:
00001 (
00002     'Page Template',
00003     'DTML Method',
00004     'DTML Document',
00005     'Filesystem DTML Method',
00006     'Filesystem Page Template',
00007     )

Definition at line 51 of file CachingPolicyManager.py.