简体   繁体   English

为plone 4实现简单的灵活性内容类型

[英]Implementing a simple dexterity content type for plone 4

I have a very frustrating start learning Plone development. 我开始学习Plone开发时感到非常沮丧。 I would like to develop a dexterity based content type for Plone 4. I'm an experienced python developer, having some knowledge of Zope and Grok, being rather new to buildout. 我想为Plone 4开发一个基于灵活性的内容类型。我是一位经验丰富的python开发人员,对Zope和Grok有一定的了解,是一个相当新的开发人员。 That said, I read "Professional Plone 4 Development" by Martin Aspeli, but quite some version information in the book seems to be outdated. 也就是说,我阅读了Martin Aspeli的“ Professional Plone 4 Development”,但是本书中的很多版本信息似乎已经过时了。

Using buildout I was able to get a Plone instance up and running. 使用buildout,我能够启动并运行Plone实例。 ZopeSkel is installed but when I try to create a new package, I get an error like this: 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)

If I try to run paster from within the given directory, it tells me, that the command "add" is not know. 如果我尝试从给定目录中运行粘贴程序,它将告诉我命令“ add”是未知的。 I tried different versions of ZopeSkel and tried the raw plone templates and also zopeskel.dexterity. 我尝试了不同版本的ZopeSkel,并尝试了原始plone模板以及zopeskel.dexterity。 The output changes slightly depending on version and template, but the result remains the same. 输出会根据版本和模板而略有变化,但是结果保持不变。

Obvisouly Plone development seems to be very sensible to version changes, which makes older documentation quite useless. 显然,Plone开发对于版本更改似乎非常明智,这使得较旧的文档非常无用。 http://plone.org/products/dexterity/documentation/manual/developer-manual tells me, that it has been updated last time 1114 ago. http://plone.org/products/dexterity/documentation/manual/developer-manual告诉我,它的上次更新时间为1114年前。

Could somebody give me a starting point to develop a very simple dexterity content type for Plone 4 which really works? 有人可以给我一个起点,为真正有用的Plone 4开发一个非常简单的灵巧内容类型吗?

For what it's worth, whilst there are a few newer versions of some packages, Professional Plone 4 Development is current with Plone 4.1. 值得一提的是,虽然某些软件包有一些较新的版本,但Plone 4.1仍是Professional Plone 4 Development的最新版本。 I would suggest you use it, and start from its sample code. 我建议您使用它,并从其示例代码开始。 Don't try to arbitrarily upgrade things until you know you have a working starting point, and you should be OK. 在知道您有一个可行的起点之前,不要尝试任意升级,并且应该没问题。

http://pigeonflight.blogspot.com/2012/01/dexterity-development-quickstart-using.html offers a nice quickstart. http://pigeonflight.blogspot.com/2012/01/dexterity-development-quickstart-using.html提供了一个不错的快速入门。 The most current Dexterity docs are at http://dexterity-developer-manual.readthedocs.org/en/latest/index.html . 最新的敏捷文档位于http://dexterity-developer-manual.readthedocs.org/en/latest/index.html Yes, this is a little bit of a moving target, documentation-wise, not so much due to Dexterity, which is stable and in production, but mainly because Zopeskel is under heavy development/modernization right now. 是的,从文档的角度来看,这只是一个移动的目标,并不是因为稳定和可生产的敏捷性,而主要是因为Zopeskel目前正在大力进行开发/现代化。 Sorry about that. 对于那个很抱歉。

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

Templer cannot coexist with old ZopeSkel in the same buildout, or Python virtualenv. Templer不能与旧的ZopeSkel在同一扩展中共存,也不能与Python virtualenv共存。

Otherwise you will encounter the following error when trying to create packages:: 否则,在尝试创建软件包时会遇到以下错误:

  IOError: No egg-info directory found (looked in ./mycompany.content/./mycompany.content.egg-info, ....

Templer is the latest incarnation of ZopeSkel(version 3). Templer是ZopeSkel(版本3)的最新版本。 I am not sure what version of ZopeSkel you have or if you have mixed versions installed in buildout or virtualenv. 我不确定您使用的ZopeSkel是哪个版本,或者您是否在buildout或virtualenv中安装了混合版本。 But the conflicting installation of ZopeSkel is likely the culprit. 但是ZopeSkel的安装冲突可能是罪魁祸首。

I would start from scratch and recreate vitualenv and just install the latest version of ZopeSkel 2 via buildout. 我将从头开始并重新创建vitualenv,然后通过构建安装最新版本的ZopeSkel 2。 ZopeSkel 3 or Templer is still in heavy development and not all templates have been migrated. ZopeSkel 3或Templer仍在开发中,并且并非所有模板都已迁移。

I was able to create a new Plone 4.1.4 site with a new Dexterity content-type using this buildout. 使用此扩展,我能够使用新的Dexterity内容类型创建一个新的Plone 4.1.4站点。 This should not be an official answer but pasting the configuration to a volatile service like pastebin is not an option for permanent documentation. 这不应该是正式的答案,但是将配置粘贴到诸如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]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM