source: products/vendor/Products.CacheSetup/current/Products/CacheSetup/skins/cache_setup/page_cache_setup.cpy @ 3296

Last change on this file since 3296 was 3296, checked in by fenix, 13 years ago

Load Products.CacheSetup?-1.2.1 into vendor/Products.CacheSetup?/current.

  • Property svn:eol-style set to native
File size: 980 bytes
Line 
1## Script (Python) "page_cache_setup"
2##title=Configure the page cache manager
3##bind container=container
4##bind context=context
5##bind namespace=
6##bind script=script
7##bind state=state
8##bind subpath=traverse_subpath
9##parameters=
10##
11
12from Products.CacheSetup.config import PAGE_CACHE_MANAGER_ID
13
14page_cache = getattr(context, PAGE_CACHE_MANAGER_ID)
15title = page_cache.Title()
16request = context.REQUEST
17settings = {'threshold': request.get('threshold', 1000),
18            'cleanup_interval': request.get('cleanup_interval', 300),
19            'max_age': request.get('max_age', 3600),
20            'active': request.get('active', 'on_always'),
21           }
22page_cache.manage_editProps(title, settings=settings)
23
24try:
25    from Products.CMFPlone import PloneMessageFactory as _
26    context.plone_utils.addPortalMessage(_(u'PageCache settings changed.'))
27except:
28    # we're not in 2.5
29    state.set(status='success', portal_status_message='PageCache settings changed.')
30return state
Note: See TracBrowser for help on using the repository browser.