KeyError during restrictedTraverse
You have a traceback similiar to this:
Traceback (innermost last):
Module ZPublisher.Publish, line 113, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 40, in call_object
Module Products.Archetypes.BaseFolder, line 57, in __call__
Module Shared.DC.Scripts.Bindings, line 311, in __call__
Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
Module Products.CMFCore.FSPageTemplate, line 188, in _exec
Module Products.CMFCore.FSPageTemplate, line 127, in pt_render
Module Products.PageTemplates.PageTemplate, line 102, in pt_render
- <FSPageTemplate at /Plone/base_view used for /Plone/usability>
Module TAL.TALInterpreter, line 206, in __call__
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 709, in do_useMacro
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 426, in do_optTag_tal
Module TAL.TALInterpreter, line 411, in do_optTag
Module TAL.TALInterpreter, line 406, in no_tag
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 740, in do_defineSlot
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 426, in do_optTag_tal
Module TAL.TALInterpreter, line 411, in do_optTag
Module TAL.TALInterpreter, line 406, in no_tag
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 688, in do_defineMacro
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 732, in do_defineSlot
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 426, in do_optTag_tal
Module TAL.TALInterpreter, line 411, in do_optTag
Module TAL.TALInterpreter, line 406, in no_tag
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 688, in do_defineMacro
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 426, in do_optTag_tal
Module TAL.TALInterpreter, line 411, in do_optTag
Module TAL.TALInterpreter, line 406, in no_tag
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 709, in do_useMacro
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 477, in do_setLocal_tal
Module Products.PageTemplates.TALES, line 221, in evaluate
- URL: file:Archetypes/skins/archetypes/base.pt
- Line 82, Column 8
- Expression: standard:'field_macro | here/widgets/field/macros/view'
- Names:
{'container': <PloneSite at /Plone>,
'context': <ApplicationFolder at /Plone/usability>,
'default': <Products.PageTemplates.TALES.Default instance at 0x0145B670>,
'here': <ApplicationFolder at /Plone/usability>,
'loop': <Products.PageTemplates.TALES.SafeMapping object at 0x0450F120>,
'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0x0144E800>,
'nothing': None,
'options': {'args': ()},
'repeat': <Products.PageTemplates.TALES.SafeMapping object at 0x0450F120>,
'request': <HTTPRequest, URL=http://localhost/usability>,
'root': <Application at >,
'template': <FSPageTemplate at /Plone/base_view used for /Plone/usability>,
'traverse_subpath': [],
'user': admin}
Module Products.PageTemplates.Expressions, line 183, in __call__
Module Products.PageTemplates.Expressions, line 171, in _eval
Module Products.PageTemplates.Expressions, line 127, in _eval
- __traceback_info__: here
Module Products.PageTemplates.Expressions, line 306, in restrictedTraverse
- __traceback_info__: {'path': ['widgets', 'field', 'macros', 'view'], 'TraversalRequestNameStack': ['view', 'macros']}
Module OFS.ObjectManager, line 704, in __getitem__
KeyError: 'field'
Looks like something was unable to access "field" which is part of some object. Crucial information here is traceback_info:
__traceback_info__: {'path': ['widgets', 'field', 'macros', 'view'], 'TraversalRequestNameStack': ['view', 'macros']}
Here you can see page template path which was accessed. In this case, it was widgets/field.pt -> macros/view. Page template was unable to find field.pt in widgets directory, thus KeyError: "field".
This is caused by missing files in skin folders. In my case, I had created widgets folder under the skin folder of my own product. This override Archetypes internal skin folder, thus making field.pt unavailable. The solution was to rename my skins/usability/widgets folder to skins/usability/usability_widgets.
