KeyError:' prefs_main_template'

时间:2017-10-31 11:59:39

标签: plone-4.x plone-5.x

我尝试安装自定义包。

这是针对具有原型的Plone4。

访问http://0.0.0.0:8086/Plone/@@site-controlpanel出现此错误。

这是什么意思?

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>

然后我在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)
  • 名称为prefs_main_template。
  • obj是PloneSite。
  • 并且getattr返回None。

1 个答案:

答案 0 :(得分:0)

要仅修复该错误,您可以将原始模板的副本添加到其中一个皮肤文件夹中。

要获取原始模板,请转到https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/skins/plone_prefs/prefs_main_template.pt并根据您在下拉菜单中使用的Plone-vs选择标记,其中显示“Branch:master”。

然而,真正的问题是Plone的皮肤文件夹已被删除。 除了不应该这样做之外,您还需要重新创建缺少的皮肤文件,或者考虑创建一个安装了相同附加组件的新Plonesite,并将内容从旧网站移动到新网站。