开发者

collective.monkeypatch fails to detect Zope version (z3c.form)

开发者 https://www.devze.com 2023-02-19 16:12 出处:网络
On some of our servers collectiv开发者_C百科e.monkeypatch does not work: Unable to detect Zope version. Please make sure you have Zope 2.10.4 or newer installed.

On some of our servers collectiv开发者_C百科e.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


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.


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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号