Five Tutorial for Plone developers

Author: Philipp von Weitershausen
Date: 2005-11-27 02:07:05 +0800 (Sun, 27 Nov 2005)
Version: 1.1
Copyright: 2005 by Philipp von Weitershausen
License:CreativeCommons This work is published and may be distributed under the terms of the Creative Commons Attribution-NonCommercial-NoDerivs 2.5 License.

Introduction

This document teaches you how to use Five. Its goals are to familiarize you with some Zope 3 idioms and demonstrate how they are applied in a grown Zope 2 environment. It will do so in five steps, thus let you experience the iterative development process that has been acquired by Zope 3 developers and been used in my book as well. It will stop after those five steps, but still leave you with some possibilities to pad out the code with your own components.

To provide a realistic example, this tutorial will show how to extend Plone to support the Atom syndication format in addition to RSS by using Zope 3 technologies. Very little Plone and CMF APIs are going to be exercised and later abstractions in the last step ensure the reuse of such a feature in other platforms, not limited to Plone or even Zope 2.

This text is based on a hands-on 90-minute tutorial given at the Plone Conference 2005 in Vienna.

About Five

Five is a Zope 2 product that allows you to integrate Zope 3 technologies into Zope 2, today. It allows you to use all parts of the Zope 3 component architecture within Zope 2, namely interfaces, adapters and views. It also re-implements a few features known from Zope 3, such as the automatic generation of add and edit forms based on schemas, so that they can be used in a Zope 2 environment.

Target audience

This tutorial explicitly targets Plone 2 developers. That means you should have good experience with writing Zope 2 and Plone 2 "products". You do not need to know Zope 3 at all, but some experience helps, of course.

You are probably interested in this tutorial because Five is what Zope 2, CMF, Plone, etc. are headed to and you want to jump on that train now.

About the author

My name is Philipp von Weitershausen. I attend Dresden University of Technology for Physics. I also am an independent software developer, a main contributor to Zope 3 and Five and the author of the Springer-Verlag book Web Component Development with Zope 3.

Acknowledgements

Thanks to...

  • Martin Aspeli for giving me the idea of turning this into a full-blown tutorial,
  • Alexander Limi, Rocky Burt for some typo spotting,
  • Jerome Perrin, Bruno Rezende for some technical feedback,
  • all the attendees of the tutorial at Plone Conference 2005 that gave me positive feedback afterwards and thus encouraged me to publish the tutorial as prose.

Changes in version 1.1

  • Added summaries at the end of each step
  • Linked to the source files for each source code listing
  • Typo fixes

Preparation

Before we start, we need to set a few things up. In order to use Five, we need to use Zope 2.8 because it ships with Five. So, take a recent Zope 2.8 installation (most recent at the time of writing was 2.8.4) and create a new instance. Then install the Plone 2.1.1 or higher bundle. Plone 2.1.0 will not work due to a bug in the versions of Archetypes and ATContentTypes shipping with it.

After having created the instance and installed Plone, log on to the ZMI and create a Plone site. I will use the name portal throughout this tutorial, so URLs will start with http://localhost:8080/portal.

Contents

Step 1: Interfaces

Step 2: ZCML

Step 3: Simple browser pages

Step 4: Enhanced browser pages

Step 5: Adapters

Further reading

If you've enjoyed this tutorial and like my style of writing as well as the technology involved, please consider buying my book Web Component Development with Zope 3. The income from the book will allow me to continue to contribute to open source projects like Zope 3 and Five as well as create further documentation like this tutorial. Of course, you can also hire me.

Other resources: