【问题标题】:Developing grok-style Dexterity add-ons in Plone 4.3在 Plone 4.3 中开发 grok 风格的敏捷插件
【发布时间】:2012-10-30 12:50:28
【问题描述】:

根据:

要在 Plone 4.3 中使用 grok-style 声明,必须通过带有 setuptools 额外要求的 buildout 安装 Dexterity : grok 和关系(参考 plone.app.dexterity 的 setup.py 中的extras_require 定义)。但是想要代表最终用户执行此配置的插件开发人员应该怎么做呢?

使用我的 collective.project 插件,我从 plone.app.dexterity 复制了 extras_require

setup(
    author='Alex Clark',
    author_email='aclark@aclark.net',
    description='Demo app: project management with dexterity content types.',
    entry_points={
        'z3c.autoinclude.plugin': 'target = plone',
    },
    extras_require = {
        'test': [
            'plone.app.testing',
            'unittest2'
            ],
        'grok': [
            'five.grok',
            'plone.directives.dexterity',
            'plone.directives.form >=1.1dev',
            ],
        'relations': [
            'plone.app.relationfield',
            'plone.app.intid',
            'z3c.relationfield',
            ]
    },

这允许最终用户安装collective.project 只需添加到鸡蛋列表,例如

[plone]
recipe = plone.recipe.zope2instance
eggs =
  Pillow
  Plone
  collective.project

这是一个合理的方法吗?

【问题讨论】:

  • 啊,我自欺欺人了;以上实际上根本不起作用。我会回答这个问题。

标签: plone setuptools buildout dexterity grok


【解决方案1】:

不,不是。不要从 plone.app.dexterity 复制 extras_require,它没有帮助(尽管可能包括 extras_require 作为 install_requires 会起作用,但这会破坏 extras_require 的目的)

但是,您可以使用与 Buildout 类似的语法在 setup.py 中指定 extras_require

install_requires=[
    'setuptools',
    'plone.app.dexterity[grok]',
],

【讨论】:

  • 当然,只有当您的插件确实需要 grok 和关系支持时,您才应该这样做。
  • 对。根据安装手册:“默认情况下,将 plone.app.dexterity 添加到您的鸡蛋中不再启用 grok 样式的配置或关系字段功能。”因为我不需要关系领域的支持,所以我应该把它排除在外。我会编辑。
  • 你能接受你的答案是正确的吗?几天过去了,现在应该可以了
猜你喜欢
  • 1970-01-01
  • 2013-02-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多