Last change
on this file 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:
892 bytes
|
Rev | Line | |
---|
[3296] | 1 | from Products.CMFCore.utils import getToolByName |
---|
| 2 | from zope.event import notify |
---|
| 3 | |
---|
| 4 | try: |
---|
| 5 | from Products.Archetypes.event import ObjectInitializedEvent |
---|
| 6 | AT15 = True |
---|
| 7 | except ImportError: |
---|
| 8 | # Plone 2.5 compatibility |
---|
| 9 | AT15 = False |
---|
| 10 | |
---|
| 11 | def setupVarious(context): |
---|
| 12 | logger = context.getLogger("CacheSetup") |
---|
| 13 | if context.readDataFile("cachesetup-various.txt") is None: |
---|
| 14 | logger.info("Nothing to do") |
---|
| 15 | return |
---|
| 16 | |
---|
| 17 | site = context.getSite() |
---|
| 18 | |
---|
| 19 | # The tool is not created through the standard AT factory method, |
---|
| 20 | # so we need to do the required initialization here. |
---|
| 21 | pcs = getToolByName(site, "portal_cache_settings") |
---|
| 22 | if getattr(pcs, "_at_creation_flag", True): |
---|
| 23 | pcs.initializeArchetype() |
---|
| 24 | pcs.unmarkCreationFlag() |
---|
| 25 | if AT15: notify(ObjectInitializedEvent(pcs)) |
---|
| 26 | logger.info("Initialized cache settings tool") |
---|
| 27 | pcs.updateInstalledVersion() |
---|
| 28 | |
---|
| 29 | |
---|
Note: See
TracBrowser
for help on using the repository browser.