Creating the package

by Martin Aspeli last modified Feb 04, 2009 03:05 AM
First, we must create a new package to house our new condition

We will use an egg-based package and install it into a buildout. See the buildout tutorial for more information about how to install Paste Script and ZopeSkel, and how to add new packages to a buildout.

First, we create a package in the src/ directory of a Plone 3 buildout:

$ cd src
$ paster create -t plone collective.keywordcondition
Selected and implied templates:
  ZopeSkel#basic_namespace  A project with a namespace package
  ZopeSkel#plone            A Plone project

Variables:
  egg:      collective.keywordcondition
  package:  collectivekeywordcondition
  project:  collective.keywordcondition
Enter namespace_package (Namespace package (like plone)) ['plone']: collective
Enter package (The package contained namespace package (like example)) ['example']: keywordcondition
Enter zope2product (Are you creating a Zope 2 Product?) [False]: False
...
Enter zip_safe (True/False: if the package can be distributed as a .zip file) [False]: False

The important questions to answer are the namespace package and package name (here corresponding to the egg name, collective.keywordcondition), the zope2product status (False, in this case - we do not need GenericSetup product installation or other
Zope 2-like behaviour), and the zip_safe flag (False - as with all Zope packages).

Next, we must install this as a develop egg so that Zope can pick it up, and add a ZCML slug so that its ZCML is loaded on Zope startup. With a buildout-based environment, we do this by editing buildout.cfg:

[buildout]
...
eggs =
  ...
  collective.keywordcondition

developer =
  ...
  src/collective.keywordcondition

...

[instance]
...
zcml =
  ...
  collective.keywordcondition

Please refer to the buildout tutorial for more information. After making the changes, we must re-run buildout:

$ ./bin/buildout -No