2012-10-27 30 views
0

所以我試圖通過Plone 4書,我複製了包含以下行的構建文件(第51頁):Plone - 在buildout.cfg中的解析錯誤 - 「PlonePlonebuildout配置文件[測試]」

[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出版的下載說明,他們都沒有奏效。)

截圖來自我的Kindle書:

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

回答

3

PlonePlonebuildout configuration files[test]顯然是錯誤的;該行的[test]部分之前刪除一切:如果

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

不知道這是你對堆棧溢出或在您的文件格式,但你也缺少一些縮進別處:

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

的線條應遵循eggs =規範縮進,將它們標記爲eggs參數的(連續)值。這同樣適用於在[test]部分eggs =行:

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

謝謝。我正在看這本書的Kindle版本,所以也許它搞砸了格式 - 我添加了一個截圖。 – jononomo

3

看起來像是在編輯/格式出了錯這裏。

你可以找到所有的我的書的源代碼在這裏:http://github.com/optilude/optilux

使用分支選擇器選擇的一章。你可以通過網頁閱讀,或從github克隆/下載。

+0

啊,完美。非常感謝。 – jononomo