Plone/Paster - 什么会导致 "paster addcontent dexterity_content" 不起作用?

Plone/Paster - What could cause "paster addcontent dexterity_content" to not work?

我正在尝试使用 paster 创建灵巧的内容类型。 我在一个与我之前使用的文件夹不同的目标文件夹中进行了 Plone 4.3.4 的新独立安装,因此它是 buildout-cache 是干净的。

我用的OS是Ubuntu14.04。所以在我的下载文件夹中,在我提取的安装程序文件夹中,我在终端中输入:

./install.sh --target=/home/myusername/Plone2 --instance=MyProject standalone

安装正确。然后我去 Plone2 中的 MyProject。我编辑构建以更改我的密码,运行 构建:

buildout -c develop.cfg

然后我转到 src 文件夹并使用 zopeskel 创建一个新产品:

../bin/zopeskel dexterity project.house

然后我编辑我的构建,在 eggs 下添加 project.house,在 develop 下,src/project.house。然后我 运行 再次构建并且构建正确。然后在 sources 下的 project.house 文件夹中,我尝试 运行ning paster.

../../bin/paster addcontent dexterity_content

然后我得到一个错误:

Traceback (most recent call last):
  File "../../bin/paster", line 264, in <module>
    sys.exit(paste.script.command.run())
  File "/home/pjdowney/Plone2/buildout-cache/eggs/PasteScript-1.7.5-py2.7.egg/paste/script/command.py", line 104, in run
    invoke(command, command_name, options, args[1:])
  File "/home/pjdowney/Plone2/buildout-cache/eggs/PasteScript-1.7.5-py2.7.egg/paste/script/command.py", line 143, in invoke
    exit_code = runner.run(args)
  File "/home/pjdowney/Plone2/buildout-cache/eggs/PasteScript-1.7.5-py2.7.egg/paste/script/command.py", line 238, in run
    result = self.command()
  File "/home/pjdowney/Plone2/buildout-cache/eggs/ZopeSkel-2.21.2-py2.7.egg/zopeskel/localcommands/__init__.py", line 70, in command
    self._extend_templates(templates, args[0])
  File "/home/pjdowney/Plone2/buildout-cache/eggs/ZopeSkel-2.21.2-py2.7.egg/zopeskel/localcommands/__init__.py", line 204, in _extend_templates
    tmpl = entry.load()(entry.name)
  File "/home/pjdowney/Plone2/buildout-cache/eggs/setuptools-7.0-py2.7.egg/pkg_resources.py", line 2184, in load
    ['__name__'])
ImportError: No module named dexterity.localcommands.dexterity

我最近在另一个目标文件夹中安装了 Plone 4.3.6。不幸的是,我从未尝试过使用 paster,因为我是通过网络创建灵巧的内容。切换到 4.3.6 会毁了一切吗?

我之前的目标文件夹仍然有效。

将“"ImportError: No module named dexterity.localcommands.dexterity" + "plone" 扔进搜索引擎直接导致 Plone 4.3.4 - ImportError: No module named dexterity.localcommands.dexterity where S. McMahon states it's a bug reported in https://github.com/plone/Installers-UnifiedInstaller/issues/33 并且已经针对 Plone-5 安装程序修复,但不是针对 Plone-4。

这个错误可能是由于最新的setuptools-version和FWIW引起的,有一天我在“glyph”的推文中无意中发现了这些信息,看起来很有帮助:

"Public Service Announcement: make @dstufft’s life easier, and do not use the `python-pip´ package from Debian or Ubuntu. It’s broken." (1)

"Instead, install pip and virtualenv with get-pip.py, ideally into your home directory. (Sadly, https://pip2014.com/ is still relevant.)" (2)

当 运行 再次出现问题时,我会仔细查看有望拯救的脚本 get-pip.py,但现在,我只是不升级任何东西:-D

(1)https://twitter.com/glyph/status/640980540691234816 (2)https://twitter.com/glyph/status/640980540691234816

(从我自己对 github 中类似问题的评论中复制)

I've had fights like this in the past with zopeskel / paster. Nowadays though I avoid it.... choosing to use:

  • mrbob for templating eggs
  • creating dexterity types through the web see plone training
  • OR alternatively creating dexterity types directly in code without templating - there's a lot less boilerplate code in dexterity cf archetypes

我怀疑您的问题是因为您安装的 4.3.6 可能已将 zopeskel 或其依赖项之一升级为对 localcommands/templates 有不同要求的东西。如果你想继续这场斗争(我不推荐它),那么你可以尝试将你所有的 zopeskel 依赖项固定到最新版本(尽管我相信 Zopeskel 必须低于 3.0)