为plone 4实现一个简单的灵巧内容类型

时间:2012-08-12 14:17:44

标签: python plone dexterity zopeskel

我开始学习Plone开发非常令人沮丧。我想为Plone 4开发一个基于灵巧的内容类型。我是一位经验丰富的python开发人员,对Zope和Grok有一些了解,对于buildout来说是一个新手。也就是说,我读过Martin Aspeli撰写的“Professional Plone 4 Development”,但书中的一些版本信息似乎已经过时了。

使用buildout我能够启动并运行Plone实例。 ZopeSkel已安装,但是当我尝试创建一个新包时,我收到如下错误:

**************************************************************************
**  Your new package supports local commands.  To access them, change
**  directories into the 'src' directory inside your new package.
**  From there, you will be able to run the command `paster add
**  --list` to see the local commands available for this package.
**************************************************************************


ERROR: No egg-info directory found (looked in ./domma.voucher/./domma.voucher.egg-info, ./domma.voucher/bootstrap.py/domma.voucher.egg-info, ./domma.voucher/bootstrap.pyo/domma.voucher.egg-info, ./domma.voucher/buildout.cfg/domma.voucher.egg-info, ./domma.voucher/CHANGES.txt/domma.voucher.egg-info, ./domma.voucher/CONTRIBUTORS.txt/domma.voucher.egg-info, ./domma.voucher/docs/domma.voucher.egg-info, ./domma.voucher/domma/domma.voucher.egg-info, ./domma.voucher/README.txt/domma.voucher.egg-info, ./domma.voucher/setup.cfg/domma.voucher.egg-info, ./domma.voucher/setup.py/domma.voucher.egg-info, ./domma.voucher/src/domma.voucher.egg-info)

如果我尝试从给定目录中运行paster,它告诉我,“add”命令不知道。我尝试了不同版本的ZopeSkel并尝试了原始的plone模板以及zopeskel.dexterity。输出稍有不同,具体取决于版本和模板,但结果保持不变。

显然,Plone开发似乎对版本更改非常敏感,这使得旧文档变得毫无用处。 http://plone.org/products/dexterity/documentation/manual/developer-manual告诉我,它已于1114年前更新过。

有人能给我一个起点,为Plone 4开发一个非常简单的灵巧内容类型吗?

4 个答案:

答案 0 :(得分:3)

对于它的价值,虽然有一些新版本的包,但专业Plone 4开发是最新的Plone 4.1。我建议你使用它,并从它的示例代码开始。在你知道自己有一个有效的起点之前,不要试图任意升级,你应该没事。

答案 1 :(得分:2)

http://pigeonflight.blogspot.com/2012/01/dexterity-development-quickstart-using.html提供了一个很好的快速入门。最新的Dexterity文档位于http://dexterity-developer-manual.readthedocs.org/en/latest/index.html。是的,这是一个移动目标,文档方面,而不是由于敏捷,这是稳定和生产,但主要是因为Zopeskel目前正处于重大发展/现代化。对不起。

答案 2 :(得分:2)

来自[https://github.com/collective/templer.plone/blob/master/README.txt] [1]

Templer不能在同一个buildout中与旧的ZopeSkel共存,也不能与Python virtualenv共存。

否则在尝试创建包::

时会遇到以下错误
  IOError: No egg-info directory found (looked in ./mycompany.content/./mycompany.content.egg-info, ....

Templer是ZopeSkel(版本3)的最新版本。我不确定你有什么版本的ZopeSkel,或者你是否在buildout或virtualenv中安装了混合版本。但ZopeSkel的冲突安装很可能是罪魁祸首。

我会从头开始重新创建vitualenv并通过buildout安装最新版本的ZopeSkel 2。 ZopeSkel 3或Templer仍在大力发展,并非所有模板都已迁移。

答案 3 :(得分:1)

我能够使用此buildout创建一个新的具有新Dexterity内容类型的Plone 4.1.4站点。这不应该是官方的答案,但将配置粘贴到像pastebin这样的易变服务不是永久文档的选项。

# buildout.cfg file for Plone 4 development work
# - for production installations please use http://plone.org/download
# Each part has more information about its recipe on PyPi
# http://pypi.python.org/pypi 
# ... just reach by the recipe name
[buildout]
parts =  
    instance
    zopepy
    i18ndude
    zopeskel
    test
#    omelette

extends = 
    http://dist.plone.org/release/4.1-latest/versions.cfg
    http://good-py.appspot.com/release/dexterity/1.2.1?plone=4.1.4

# Add additional egg download sources here. dist.plone.org contains archives
# of Plone packages.
find-links =
    http://dist.plone.org/release/4.1-latest
    http://dist.plone.org/thirdparty

extensions = 
    mr.developer
    buildout.dumppickedversions

sources = sources

versions = versions

auto-checkout = 
    nva.borrow

# Create bin/instance command to manage Zope start up and shutdown
[instance]
recipe = plone.recipe.zope2instance
user = admin:admin
http-address = 16080
debug-mode = off
verbose-security = on
blob-storage = var/blobstorage
zope-conf-additional = %import sauna.reload

eggs =
    Pillow
    Plone
    nva.borrow
    sauna.reload
    plone.app.dexterity

# Some pre-Plone 3.3 packages may need you to register the package name here in 
# order their configure.zcml to be run (http://plone.org/products/plone/roadmap/247)
# - this is never required for packages in the Products namespace (Products.*)
zcml =
#    nva.borrow
    sauna.reload


# zopepy commands allows you to execute Python scripts using a PYTHONPATH 
# including all the configured eggs
[zopepy]
recipe = zc.recipe.egg
eggs = ${instance:eggs}
interpreter = zopepy
scripts = zopepy

# create bin/i18ndude command
[i18ndude]
unzip = true
recipe = zc.recipe.egg
eggs = i18ndude

# create bin/test command
[test]
recipe = zc.recipe.testrunner
defaults = ['--auto-color', '--auto-progress']
eggs =
    ${instance:eggs}

# create ZopeSkel and paster commands with dexterity support
[zopeskel]
recipe = zc.recipe.egg
eggs =
    ZopeSkel<=2.99
    PasteScript
    zopeskel.dexterity<=2.99
    ${instance:eggs}

# symlinks all Python source code to parts/omelette folder when buildout is run
# windows users will need to install additional software for this part to build 
# correctly.  See http://pypi.python.org/pypi/collective.recipe.omelette for
# relevant details.
# [omelette]
# recipe = collective.recipe.omelette
# eggs = ${instance:eggs}

# Put your mr.developer managed source code repositories here, see
# http://pypi.python.org/pypi/mr.developer for details on the format of
# this part
[sources]
nva.borrow = svn https://novareto.googlecode.com/svn/nva.borrow/trunk

# Version pindowns for new style products go here - this section extends one 
# provided in http://dist.plone.org/release/
[versions]