Collective.monkeypatch 无法检测 Zope 版本(z3c.form)

发布于 2024-10-25 17:33:51 字数 838 浏览 4 评论 0原文

在我们的一些服务器上,collective.monkeypatch 不起作用:

    Unable to detect Zope version. Please make sure you have Zope 2.10.4 or newer installed.
    2011-03-24 10:17:13 ERROR collective.monkeypatcher Could not patch because version not recognized. Wanted: [2, 13, 9], Installed: []
    2011-03-24 10:17:13 INFO collective.monkeypatcher Preconditions for patching scope <class 'z3c.form.form.BaseForm'> not met (Zope2-=2.13.999)!
    2011-03-24 10:17:13 ERROR collective.monkeypatcher Could not patch because version not recognized. Wanted: [2, 13, 9], Installed: []
    2011-03-24 10:17:13 INFO collective.monkeypatcher Preconditions for patching scope <class 'z3c.form.group.GroupForm'> not met (Zope2-=2.13.999)!

我们已经在不同的计算机上尝试了一些构建,但无法找出失败的可靠模式(可能是与 Egg 和版本 pindown 有关的东西)

可能是什么问题以及如何解决

On some of our servers collective.monkeypatch does not work:

    Unable to detect Zope version. Please make sure you have Zope 2.10.4 or newer installed.
    2011-03-24 10:17:13 ERROR collective.monkeypatcher Could not patch because version not recognized. Wanted: [2, 13, 9], Installed: []
    2011-03-24 10:17:13 INFO collective.monkeypatcher Preconditions for patching scope <class 'z3c.form.form.BaseForm'> not met (Zope2-=2.13.999)!
    2011-03-24 10:17:13 ERROR collective.monkeypatcher Could not patch because version not recognized. Wanted: [2, 13, 9], Installed: []
    2011-03-24 10:17:13 INFO collective.monkeypatcher Preconditions for patching scope <class 'z3c.form.group.GroupForm'> not met (Zope2-=2.13.999)!

We have tried the some buildout on different computers and cannot come up with reliable pattern why it is failing (probably something egg and version pindown related)

What could be the issue and how to

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

極樂鬼 2024-11-01 17:33:51

无法检测 Zope 版本。请确保您安装了 Zope 2.10.4 或更高版本。 来自较旧的 Plone 版本(版本 3.0 及更早版本,已在 3.1 行中删除)。它使用旧式的 App.version_txt.getZopeVersion API 从 Zope2 模块目录读取 version.txt 文件,但并不总是写入。无论如何,我在使用 plone.recipe.zope2install 配方安装的 Zope2 安装中都没有看到它。如果您使用 Zope 2.10.4 或更高版本,则此日志消息是无害的。

随着适当的 Zope2 Egg 的出现,Plone 现在使用 pkg_resources 模块进行此测试,并且在 Zope 2.12 中,getZopeVersion API 在内部使用 pkg_resources以及。 Collective.monkeypatcher 前置条件测试还使用 pkg_resources 来内省包版本。

从您的 无法检测 Zope 版本 日志条目中,我推断您使用的是较旧的 Plone 版本(3.0 或更早版本),因此您很可能使用 Zope 2.10。 Zope 2.10 不是 Egg,因此没有 Egg 元数据可供 pkg_resources 从中获取版本。因此,对于 2.12 之前的任何 Zope 版本,版本测试都会失败。

明显的解决方法是不在 2.12 之前的 Zope 服务器上使用定义 Monkeypatch 的包。但您也可以使用 plone.recipe.zope2install 配方中包含的版本信息生成假鸡蛋:

[zope2]
recipe = plone.recipe.zope2install
...
additional-fake-eggs =
    Zope2 = 2.10.11

假鸡蛋为 pkg_resources 提供足够的元数据来获取版本号,但 zope2install 配方写入默认的 Zope2 0.0版本的假鸡蛋。通过使用版本号定义假鸡蛋,您最终会得到 pkg_resources 为您提供足够的信息来满足先决条件。您可能需要升级您的 plone.recipe.zope2install 版本,我发现一些重构和错误修复已应用于假鸡蛋的生成方式,这可能会影响您。

The Unable to detect Zope version. Please make sure you have Zope 2.10.4 or newer installed. comes from older Plone versions (version 3.0 and earlier, it was removed in the 3.1 line). It uses the old-style App.version_txt.getZopeVersion API to read a version.txt file from the Zope2 module directory, but that is not always written. I do not see it in my Zope2 installs installed with the plone.recipe.zope2install recipe in any case. This log message is otherwise harmless provided you do use Zope 2.10.4 or newer.

With the advent of a proper Zope2 egg, Plone now uses the pkg_resources module to make this test and in Zope 2.12 the getZopeVersion API uses pkg_resources internally as well. The collective.monkeypatcher precondition test also uses pkg_resources to introspect package versions.

From your Unable to detect Zope version log entry I infer that you are using an older Plone version (3.0 or older) and thus you are most likely using Zope 2.10. Zope 2.10 is not an egg, so there is no egg metadata for pkg_resources to get a version from. Thus the version test fails for any Zope version before 2.12.

The obvious work-around is to not use the package defining the monkeypatch on Zope servers older than 2.12. But you can also generate a fake egg with the version information included with the plone.recipe.zope2install recipe:

[zope2]
recipe = plone.recipe.zope2install
...
additional-fake-eggs =
    Zope2 = 2.10.11

Fake eggs provide enough metadata for pkg_resources to get a version number, but the zope2install recipe writes a default Zope2 fake egg with a 0.0 version. By defining the fake egg with a version number you end up with pkg_resources giving you enough information to satisfy the precondition. You may have to upgrade your plone.recipe.zope2install version, I see some refactoring and bug-fixes have been applied to the way fake eggs are generated that may affect you.

空心↖ 2024-11-01 17:33:51

我认为问题出在 Monkeypatch 指令的 preconditions 属性中。

请参阅 http://pypi.python.org/pypi/collective.monkeypatcher 处的文档

I think the problem is in the preconditions attribute of your monkeypatch directive.

See documentation at http://pypi.python.org/pypi/collective.monkeypatcher

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文