Personal tools
You are here: Home Documentation Tutorials Introduction to zc.buildout zc.sharing example

zc.sharing example

A small example of the "system assembly" use case. We define a Zope 3 instance, and a test script.
Jim Fulton's tutorial for using buildout, originally given at DZUG 2007
Page 15 of 17.

Example: zc.sharing (1/2)

[buildout]
develop = . zc.security
parts = instance test
find-links = http://download.zope.org/distribution/

[instance]
recipe = zc.recipe.zope3instance
database = data
user = jim:123
eggs = zc.sharing
zcml =
  zc.resourcelibrary zc.resourcelibrary-meta
  zc.sharing-overrides:configure.zcml zc.sharing-meta
  zc.sharing:privs.zcml zc.sharing:zope.manager-admin.zcml
  zc.security zc.table zope.app.securitypolicy-meta zope.app.twisted
  zope.app.authentication
handout

This is a small example of the "system assembly" use case. In this case, we define a Zope 3 instance, and a test script.

You can largely ignore the details of the Zope 3 instance recipe. If you aren't a Zope user, you don't care. If you are a Zope user, you should be aware that much better recipes have been developped.

This project uses multiple source directories, the current directory and the zc.security directory, which is a subversion external to a project without its own distribution. We've listed both in the develop option.

We've requested the instance and test parts. We'll get other parts installed due to dependencies of the instance part. In particular, we'll get a Zope 3 checkout because the instance recipe refers to the zope3 part. We'll get a database part because of the reference in the database option of the instance recipe.

The buildout will look for distributions at http://download.zope.org/distribution/.

Example: zc.sharing (2/2)

[zope3]
recipe = zc.recipe.zope3checkout
url = svn://svn.zope.org/repos/main/Zope3/branches/3.3

[data]
recipe = zc.recipe.filestorage

[test]
recipe = zc.recipe.testrunner
defaults = ['--tests-pattern', 'f?tests$']
eggs = zc.sharing
       zc.security
extra-paths = ${zope3:location}/src
handout

Here we see the definition of the remaining parts.

The test part has some options we haven't seen before.

  • We've customized the way the testrunner finds tests by providing some testrunner default arguments.
  • We've used the extra-paths option to tell the test runner to include the Zope 3 checkout source directory in sys.path. This is not necessary as Zope 3 is now available entirely as eggs.