Plone - buildout.cfg中的解析错误 - “PlonePlonebuildout配置文件[test]”

时间:2012-10-27 20:56:25

标签: plone zope buildout

所以我正在尝试通过Plone 4书,我复制了一个包含以下行的buildout文件(来自第51页):

[instance]
recipe = plone.recipe.zope2instance
http-address = 8080
user = admin:admin
verbose-security = on
eggs =
${eggs:main}
${eggs:devtools}

# Test runner. Run: ``bin/test`` to execute all tests
PlonePlonebuildout configuration files[test]
recipe = zc.recipe.testrunner
eggs =
${eggs:test}
defaults = ['--auto-color', '--auto-progress']

# Coverage report generator.
# Run: ``bin/test --coverage=coverage`` # and then: ``bin/coveragereport``
[coverage-report]
recipe = zc.recipe.egg
eggs = z3c.coverage
scripts = coveragereport
arguments = ('parts/test/coverage', 'coverage')

当我尝试运行bin/buildout时,收到以下错误消息:

ParsingError: File contains parsing errors: /Users/Jon/dev/pln42/buildout.cfg
    [line 32]: 'PlonePlonebuildout configuration files[test]\n'

我在相关行之前和之后包含了一些行,以便提供上下文。由于我直接从书中复制了该行,因此我不知道如何更改它以使解析错误消失。

(源代码据说可在线获取,但我已尝试按照Packt Publishing的下载说明进行操作,但他们没有使用。)

我的Kindle书的截图:

A screenshot of the code I am trying to follow in the Plone 4 book

2 个答案:

答案 0 :(得分:3)

PlonePlonebuildout configuration files[test]显然是错误的;删除该行的[test]部分之前的所有内容:

# Test runner. Run: ``bin/test`` to execute all tests
[test]
recipe = zc.recipe.testrunner

不确定它是否是您在Stack Overflow或您的文件中的格式,但您也错过了其他地方的缩进:

[instance]
recipe = plone.recipe.zope2instance
http-address = 8080
user = admin:admin
verbose-security = on
eggs =
  ${eggs:main}
  ${eggs:devtools}

eggs =规范之后的行应缩进,以将其标记为eggs参数的(连续)值。 eggs =部分中的[test]行也是如此:

[test]
recipe = zc.recipe.testrunner
eggs =
  ${eggs:test}
defaults = ['--auto-color', '--auto-progress']

答案 1 :(得分:3)

在这里编辑/格式化时看起来出了问题。

您可以在此处找到我所有图书的源代码:http://github.com/optilude/optilux

使用分支选择器选择章节。您可以通过Web阅读,也可以从github克隆/下载。