英文:
Plone Error After Migration: KeyError('language',)
问题
我有一个与版本3.2.2兼容的Plone数据库。我在Docker镜像中运行了Plone版本4.3,并进行了升级(至4.3)。迁移成功完成(或至少我在最后得到的消息是这样说的)。然后我尝试访问网站,并收到了下面的错误。另外,当我尝试使用版本6.0时,一切都不起作用,所以我使用了我在公共Docker镜像中找到的最旧版本的Plone...
是否有工具(或机制)可以对数据库应用修复,以便可以以部分方式加载它?
(我没有处理服务器的经验,作为客户端的经验也很少...)
在前端():
KeyError('language',)(另外,在尝试呈现标准错误消息时发生以下错误,请查看事件日志以获取完整详情:language)
在服务器端:
模块zope.tales.tales,第696行,在evaluate中
- URL: main_template
- 第5行,第0列
- 表达式: <PathExpr standard:u'language'>
- 名称:
{'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'>}
模块zope.tales.expressions,第217行,在__call__中
模块Products.PageTemplates.Expressions,第147行,在_eval中
模块zope.tales.expressions,第118行,在_eval中
KeyError: 'language'
英文:
I have a Plone database compatible with version 3.2.2. I ran Plone version 4.3 in a docker image and upgraded (to 4.3). The migration completed successfully (or at least a message I got at the end claimed so). Then I attempted to visit the site and got the errors below. BW, when I tried version 6.0 nothing worked, so I used the oldest version of Plone I could find in a public docker image...
Is there a tool (or a mechanism) that applies fixes to the database so that it can be loaded, even in a partial way?
(I have no experience dealing with the server and very little as a client...)
On the front end ():
KeyError('language',) (Also, the following error occurred while attempting to render the standard error message, please see the event log for full details: language)
On the server side:
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'
答案1
得分: 2
以下是翻译好的部分:
"With an uncustomized standard main_template and the base_view, no error should happen."
使用未经定制的标准main_template和base_view,不应该发生错误。
"Maybe there's an addon installed, which overrides the main_template."
可能安装了一个插件,它覆盖了main_template。
"As you write you want to merely access content, that would be also possible with an export via the GenericSetup tool:"
正如您所写,您只想访问内容,这也可以通过GenericSetup工具进行导出:
"Call [SITE_URL]/portal_setup/manage_exportSteps
in a browser, search for 'Content', check the box next to it, scroll down to the end of the page and click 'Export selected steps'."
在浏览器中调用[SITE_URL]/portal_setup/manage_exportSteps
,搜索'Content',选中旁边的复选框,滚动到页面底部,然后点击'Export selected steps'。
"Also you can access the site from the commandline, by adding a script in the ZOPE instance's directory (where buildout.cfg
lives, too) and run it like that: ./bin/instance run yourscript.py
, the Zope object (parent of the Plone site) is then available as the variable app
[1], so if your site's id is 'Plone', you could access it with app['Plone']
."
您还可以通过在ZOPE实例目录中添加一个脚本(与buildout.cfg
位于同一目录中)并像这样运行它来从命令行访问网站:./bin/instance run yourscript.py
,然后Zope对象(Plone网站的父对象)将作为变量app
[1]可用,因此如果您的站点ID是'Plone',您可以使用app['Plone']
来访问它。
"It takes some time until the script finishes because all modules are loaded. You can add a breakpoint in the script for an interactive inspection, to play around without the need to run the whole script after each change: from pdb import set_trace; set_trace()
"
脚本运行时间较长,因为加载了所有模块。您可以在脚本中添加一个断点以进行交互式检查,以便无需在每次更改后运行整个脚本即可进行操作:from pdb import set_trace; set_trace()
"For the records, here's a recipe on how to do it with even older versions:"
供参考,以下是使用更旧版本的方法的示例:
http://web.archive.org/web/20070302234456/http://zopelabs.com/cookbook/1054240694/1054240694
[1] https://zope.readthedocs.io/en/latest/operation.html#id4
[1] https://zope.readthedocs.io/en/latest/operation.html#id4
英文:
With an uncustomized standard main_template and the base_view, no error should happen.
Maybe there's an addon installed, which overrides the main_template.
As you write you want to merely access content, that would be also possible with an export via the GenericSetup tool:
Call [SITE_URL]/portal_setup/manage_exportSteps
in a browser, search for 'Content', check the box next to it, scroll down to the end of the page and click 'Export selected steps'.
Also you can access the site from the commandline, by adding a script in the ZOPE instance's directory (where buildout.cfg
lives, too)
and run it like that: ./bin/instance run yourscript.py
, the Zope object (parent of the Plone site) is then available as the variable app
[1],
so if your site's id is 'Plone', you could access it with app['Plone']
It takes some time until the script finishes, because all modules are loaded. You can add a breakpoint in the script for an interactive inspection, to play around without the need to run the whole script after each change: from pdb import set_trace; set_trace()
For the records, here's a recipe on how to do it with even older versions:
http://web.archive.org/web/20070302234456/http://zopelabs.com/cookbook/1054240694/1054240694
[1] https://zope.readthedocs.io/en/latest/operation.html#id4
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论