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
|
Rev | Line | |
---|
[3296] | 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 | |
---|
| 12 | from Products.CacheSetup.config import PAGE_CACHE_MANAGER_ID |
---|
| 13 | |
---|
| 14 | page_cache = getattr(context, PAGE_CACHE_MANAGER_ID) |
---|
| 15 | title = page_cache.Title() |
---|
| 16 | request = context.REQUEST |
---|
| 17 | settings = {'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 | } |
---|
| 22 | page_cache.manage_editProps(title, settings=settings) |
---|
| 23 | |
---|
| 24 | try: |
---|
| 25 | from Products.CMFPlone import PloneMessageFactory as _ |
---|
| 26 | context.plone_utils.addPortalMessage(_(u'PageCache settings changed.')) |
---|
| 27 | except: |
---|
| 28 | # we're not in 2.5 |
---|
| 29 | state.set(status='success', portal_status_message='PageCache settings changed.') |
---|
| 30 | return state |
---|
Note: See
TracBrowser
for help on using the repository browser.