迁移后 Plone 错误:KeyError('language',)

问题描述 投票:0回答:1

我有一个与3.2.2版本兼容的Plone数据库。我在 docker 镜像中运行 Plone 版本 4.3 并升级(到 4.3)。迁移成功完成(或者至少我最后收到的一条消息声称如此)。然后我尝试访问该网站并收到以下错误。 BW,当我尝试 6.0 版本时没有任何效果,所以我使用了我可以在公共 docker 镜像中找到的最旧版本的 Plone...

是否有一种工具(或机制)可以对数据库进行修复,以便可以加载数据库,即使是部分加载? (我没有与服务器打交道的经验,也没有作为客户端的经验......)

在前端():

KeyError('language',) (Also, the following error occurred while attempting to render the standard error message, please see the event log for full details: language)

在服务器端:

  Module zope.tales.tales, line 696, in evaluate
   - URL: main_template
   - Line 5, Column 0
   - Expression: <PathExpr standard:u'language'>
   - Names:
      {'container': <PloneSite at /CGALtau>,
       'context': <ATDocument at /CGALtau/cgal-at-tel-aviv-university>,
       'default': <object object at 0x7f51ab8bd7e0>,
       'here': <ATDocument at /CGALtau/cgal-at-tel-aviv-university>,
       'loop': {},
       'nothing': None,
       'options': {'args': ()},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x7f51a06679b0>,
       'request': <HTTPRequest, URL=http://localhost:8080/CGALtau/cgal-at-tel-aviv-university/document_view>,
       'root': <Application at >,
       'template': <FSPageTemplate at /CGALtau/document_view used for /CGALtau/cgal-at-tel-aviv-university>,
       'traverse_subpath': [],
       'user': <PropertiedUser 'admin'>}
  Module zope.tales.expressions, line 217, in __call__
  Module Products.PageTemplates.Expressions, line 147, in _eval
  Module zope.tales.expressions, line 118, in _eval
KeyError: 'language'
database migration plone
1个回答
0
投票

使用未定制的标准 main_template 和 base_view,应该不会发生错误。 也许安装了一个插件,它覆盖了 main_template。

当您编写时,您只想访问内容,这也可以通过 GenericSetup 工具导出: 在浏览器中调用

[SITE_URL]/portal_setup/manage_exportSteps
,搜索“内容”,选中旁边的框,向下滚动到页面末尾,然后单击“导出所选步骤”。

您还可以通过在 ZOPE 实例的目录中添加脚本(

buildout.cfg
也存在)来从命令行访问该站点 然后像这样运行它:
./bin/instance run yourscript.py
,然后 Zope 对象(Plone 站点的父级)可用作变量
app
[1], 因此,如果您的网站 ID 是“Plone”,您可以使用
app['Plone']

访问它

脚本完成需要一些时间,因为所有模块都已加载。您可以在脚本中添加断点以进行交互式检查,无需在每次更改后运行整个脚本:

from pdb import set_trace; set_trace()

作为记录,这里有一个关于如何使用旧版本执行此操作的秘诀: http://web.archive.org/web/20070302234456/http://zopelabs.com/cookbook/1054240694/1054240694

[1] https://zope.readthedocs.io/en/latest/operation.html#id4

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.