KeyError: 'prefs_main_template'

130 Views Asked by At

I tried to install custom package.

That is made for Plone4 with archetypes.

Access http://0.0.0.0:8086/Plone/@@site-controlpanel appears this errors.

What is this mean?

2017-10-31 11:50:06 ERROR Zope.SiteErrorLog 1509450606.040.577270977101 http://0.0.0.0:8086/Plone/@@site-controlpanel
Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 48, in call_object
  Module plone.z3cform.layout, line 67, in __call__
  Module plone.z3cform.layout, line 84, in render
  Module Products.Five.browser.pagetemplatefile, line 125, in __call__
  Module Products.Five.browser.pagetemplatefile, line 59, in __call__
  Module zope.pagetemplate.pagetemplate, line 132, in pt_render
  Module five.pt.engine, line 98, in __call__
  Module z3c.pt.pagetemplate, line 163, in render
  Module chameleon.zpt.template, line 261, in render
  Module chameleon.template, line 191, in render
  Module chameleon.template, line 171, in render
  Module e50eb39ab1e3e2ab91a240ce2e2f728e.py, line 233, in render
  Module five.pt.expressions, line 154, in __call__
  Module five.pt.expressions, line 123, in traverse
  Module OFS.Traversable, line 313, in unrestrictedTraverse
   - __traceback_info__: ([], 'prefs_main_template')
KeyError: 'prefs_main_template'

 - Expression: "here/prefs_main_template/macros/master"
 - Filename:   ... .7.egg/plone/app/registry/browser/controlpanel_layout.pt
 - Location:   (line 6: col 23)
 - Source:     ... al:use-macro="here/prefs_main_template/macros/master"
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Arguments:  repeat: {...} (0)
               template: <ViewPageTemplateFile - at 0xb3b0e9ecL>
               views: <ViewMapper - at 0xb0e1a30cL>
               modules: <instance - at 0xb6393b8cL>
               args: <tuple - at 0xb74cd02cL>
               here: <ImplicitAcquisitionWrapper Plone at 0xb11b76e4L>
               user: <ImplicitAcquisitionWrapper - at 0xb114b52cL>
               nothing: <NoneType - at 0x83132e4>
               container: <ImplicitAcquisitionWrapper Plone at 0xb11b76e4L>
               request: <instance - at 0xb150ab0cL>
               wrapped_repeat: <SafeMapping - at 0xb1707fa4L>
               traverse_subpath: <list - at 0xb1ad51ccL>
               default: <object - at 0xb74f3a18L>
               loop: {...} (0)
               context: <ImplicitAcquisitionWrapper Plone at 0xb11b76e4L>
               view: <SiteControlPanel site-controlpanel at 0xb1576becL>
               translate: <function translate at 0xb30eea04L>
               root: <ImplicitAcquisitionWrapper Zope at 0xb36ca9b4L>
               options: {...} (0)
               target_language: <NoneType - at 0x83132e4>

Then I add break point at Zope2-2.13.26-py2.7.egg/OFS/Traversable.py

                    if getattr(aq_base(obj), name, _marker) is not _marker:
                        if restricted:
                            next = guarded_getattr(obj, name)
                        else:
                            import pdb; pdb.set_trace()
                            print obj, name, getattr(aq_base(obj), name, _marker)
                            next = getattr(obj, name)
  • The name is prefs_main_template.
  • The obj is PloneSite.
  • And getattr returns None.
1

There are 1 best solutions below

0
Ida On

To fix that error only, you can add a copy of the original template into one of your skin-folders.

To get the original template, go to https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/skins/plone_prefs/prefs_main_template.pt and choose the tag according to the Plone-vs you're using in the dropdown-menu where it says "Branch: master".

However, the real problem is that Plone's skin-folders have been deleted. Besides one shouldn't do that, you'd either need to recreate missing skin-files or consider creating a new Plonesite with same add-ons installed and move the content from the old to the new site.