If you are working on a Plone 3 site and are configuring cache setting using Products.Cachesetup, be warned that the latest release might give you some grey hairs.
After installing CacheSetup 1.2.1 on a production Plone and going to the Control Panel I ran into a traceback when visiting the rules page: a str object does not have a text attirbute. Quick solution:
- Uninstall CacheSetup
- Remove portal_cache_settings from your Plone directory if it’s still there
- Make sure your site is using a CacheSetup trunk version after @146125 or a version hight than 1.2.1 if it’s out.
- Reinstall Cachesetup
The problem: CacheSetup has both old python install code in Extensions/install.py and GS cachesettings.xml profiles to create the portal_cache_settings folder with 2 predefined caching policies. The vary_expression field somehow get’s set to the default string value set in the Archetypes schema instead of an Expression. Check Stefan Holek’s fix he made on trunk on October 13th. I ran into the issue on the 15th andI checked for new releases but didn’t dive into svn trunk. So lesson learned: check SVN trunk of a package first if you run into any problems with it.
What baffled me and my colleague Maurit is why this is showing up now, both Plone 3 and CacheSetup are in maintenance mode, nothing big has changed in Plone 3 for the last 10 months. Our best guess is that most installed Plone 3 sites already have an older portal_cache_settings folder which is untouched upon upgrading or activating and everybody is playing with Plone 4.
Note: CacheSetup is not to be used with Plone 4, there’s plone.app.caching and friends for that.
The full traceback: for those using search for this problem:
http://127.0.0.1:8084/********/portal_cache_settings/with-caching-proxy/rules/cache_policy_item_configTraceback (innermost last):Module ZPublisher.Publish, line 119, in publishModule ZPublisher.mapply, line 88, in mapplyModule Products.PDBDebugMode.runcall, line 70, in pdb_runcallModule ZPublisher.Publish, line 42, in call_objectModule Products.CMFFormController.FSControllerPageTemplate, line 90, in __call__Module Products.CMFFormController.BaseControllerPageTemplate, line 31, in _callModule Shared.DC.Scripts.Bindings, line 313, in __call__Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExecModule Products.CMFCore.FSPageTemplate, line 216, in _execModule Products.CacheSetup.patch_cmf, line 51, in FSPT_pt_renderModule Products.Gloworm, line 28, in pt_renderModule zope.pagetemplate.pagetemplate, line 117, in pt_render- Warning: Macro expansion failed- Warning: exceptions.KeyError: ‘folder_macros’Module zope.tal.talinterpreter, line 271, in __call__Module zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 891, in do_useMacroModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 536, in do_optTag_talModule zope.tal.talinterpreter, line 521, in do_optTagModule zope.tal.talinterpreter, line 516, in no_tagModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 891, in do_useMacroModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 536, in do_optTag_talModule zope.tal.talinterpreter, line 521, in do_optTagModule zope.tal.talinterpreter, line 516, in no_tagModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 949, in do_defineSlotModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 536, in do_optTag_talModule zope.tal.talinterpreter, line 521, in do_optTagModule zope.tal.talinterpreter, line 516, in no_tagModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 949, in do_defineSlotModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 855, in do_conditionModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 536, in do_optTag_talModule zope.tal.talinterpreter, line 521, in do_optTagModule zope.tal.talinterpreter, line 516, in no_tagModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 536, in do_optTag_talModule zope.tal.talinterpreter, line 521, in do_optTagModule zope.tal.talinterpreter, line 516, in no_tagModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 891, in do_useMacroModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 536, in do_optTag_talModule zope.tal.talinterpreter, line 521, in do_optTagModule zope.tal.talinterpreter, line 516, in no_tagModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 861, in do_defineMacroModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 536, in do_optTag_talModule zope.tal.talinterpreter, line 521, in do_optTagModule zope.tal.talinterpreter, line 516, in no_tagModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 855, in do_conditionModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 536, in do_optTag_talModule zope.tal.talinterpreter, line 521, in do_optTagModule zope.tal.talinterpreter, line 516, in no_tagModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 824, in do_loop_talModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 536, in do_optTag_talModule zope.tal.talinterpreter, line 521, in do_optTagModule zope.tal.talinterpreter, line 516, in no_tagModule zope.tal.talinterpreter, line 346, in interpretModule zope.tal.talinterpreter, line 586, in do_setLocal_talModule zope.tales.tales, line 696, in evaluate- URL: file:/Users/fred/cache-buildout/plone3/eggs/Plone-3.3.5-py2.4.egg/Products/CMFPlone/skins/plone_deprecated/old_folder_contents.pt- Line 136, Column 19- Expression: <PathExpr standard:u’item/getObjSize’>- Names:{‘container’: <PloneSite at /**********>,‘context’: <RuleFolder at /**********/portal_cache_settings/with-caching-proxy/rules>,‘default’: <object object at 0x10031d200>,‘here’: <RuleFolder at /**********/portal_cache_settings/with-caching-proxy/rules>,‘loop’: {u’item’: <Products.PageTemplates.Expressions.PathIterator object at 0x10cf40ed0>},‘nothing’: None,‘options’: {‘args’: (),‘state’: <Products.CMFFormController.ControllerState.ControllerState object at 0x10c3f8610>},‘repeat’: <Products.PageTemplates.Expressions.SafeMapping object at 0x10c41fbd8>,‘request’: <HTTPRequest, URL=http://127.0.0.1:8084/**********/portal_cache_settings/with-caching-proxy/rules/cache_policy_item_config>,‘root’: <Application at >,‘template’: <FSControllerPageTemplate at /**********/cache_policy_item_config used for /officious/portal_cache_settings/with-caching-proxy/rules>,‘traverse_subpath’: [],‘user’: <PropertiedUser ‘zestadmin’>}Module zope.tales.expressions, line 217, in __call__Module Products.PageTemplates.Expressions, line 163, in _evalModule Products.PageTemplates.Expressions, line 113, in renderModule Products.PageTemplates.ZRPythonExpr, line 81, in call_with_nsModule Products.CMFCore.FSPythonScript, line 135, in __render_with_namespace__Module Shared.DC.Scripts.Bindings, line 327, in __render_with_namespace__Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExecModule Products.CMFCore.FSPythonScript, line 196, in _execModule None, line 17, in getObjSize- <FSPythonScript at /**********/getObjSize used for /**********/portal_cache_settings/with-caching-proxy/rules/plone-content-types>- Line 17Module Products.Archetypes.BaseObject, line 590, in get_sizeModule Products.Archetypes.Field, line 820, in get_sizeModule Products.Archetypes.Field, line 731, in getRawModule Products.Archetypes.utils, line 162, in mapplyModule Products.CacheSetup.content.base_cache_rule, line 311, in getVaryExpressionAttributeError: ‘str’ object has no attribute ‘text’