SearchWiki:
  2 User(s) Active on Site
  232 Wiki Pages

Most Recently Modified

Meeting Schedules

Club Resources (edit)

How This Wiki Works

Meeting space complements of:
Computer books
            and technical books at discount prices
Check them out; they are a great source of technical books at very good prices!

If you have shopped at Nerdbooks.com, help them out by reviewing them at ResellerRatings.com. You will need your invoice number to prove you are a real customer, and not just ballot stuffing.
Recent Changes Printable View Page History Edit Page
Content Last Modified on October 24, 2005, at 12:48 AM CST

Grasping the Basic Concepts of Zope 3

Zope 3 is a redesign of Zope 2 and seeks to improve the Zope development experience. Zope 3 breaks down into the concepts of:

  • contract
  • implementation
  • presentation

Zope developers build new components based on existing ones, either sharing the implementation by subclassing, or creating new implementation that mimics common behavior by declaring compliance with existing interfaces.

Site designers build web applications by gluing together components with scripts and presentation templates.


About Components

Zope applications are built out of components. Components are pluggable, reusable, introspectable and persistent code modules. Components are written by developers and, to developers, are just Python objects (function or class) with interfaces formally defined using the Interface package.

Components need not be as heavyweight as current Zope 2 products. For example, Zope 3 components need not be persistent, nor provide a management interface.

Developers create components by editing conventional Python source in the filesystem outside of a Zope webserver.

Categories of functionality are:

content components
are designed to hold data or "content".
factory components
create other components.
view components
provide a user interface to other components.
adapter components
sit between content components and view components.
utility components
serve only one specific function, and are not designed to act on another component.
service components
are a small set of core functionality provided by the Zope platform.

About Content Components

The simplest kinds of components are Content Components. Content components are components that are designed to hold data or "content". For example, Document, and Image are examples of content components.

Content components are very simple, they generally only define an interface for controlling their content. The don't provide interfaces for doing application specific things (like, for example, mailing the content to another person) nor do they provide user interfaces like HTML pages.


About Factory Components

Factory components are components that create other components. For the most basic Zope component development, you will only need to create two kinds of components: a content component, and a factory component to create instances of that content component. Factory components are typically easy to implement (after all, their only task is to create another component).

Once you have created a content component and a factory component you can begin to immediately use your component in Zope through Python Scripts (which already come with Zope). Your component will not, however, have any kind of web management interface. For that, you need to create a Presentation Component.


About View Components

View components provide a user interface to other components. The most common pattern is to create a view component that presents (or provides a "user interface" for) a content component. An example of view components that can be used with Zope are Zope Page Templates (ZPT). Page templates are only about presentation, and should not contain any kind of application-specific logic. For example, you could create a "Show" view component that displayed your "Document" content component in HTML.

However, view components and content components may not do everything you need to develop your application. If you wish to extend your content component to have more advanced behavior (other than just storing content) you can extend them with Adapter Components.


About Adapter Components

An adapter is a general design pattern for mapping one or more interfaces into yet another. It is implemented as a component itself.

Adapters are a powerful concept used for many purposes within Zope, and useful outside of Zope as well. For example, the Twisted Framework is using interfaces and adapters as well.

Adapter components sit between content components and view components. Typically, they are used to provide application specific functionality to your content components.

For example, your "Document" content component may have an edit() method, but it does not have a `mailToSubscribers() method that you need to satisfy your requirements. Instead of changing the content component or the view component, new application specific features are added by creating a adapter component.


About Utility Components

Utility components are components that serve only one specific function, and are not designed to act on another component. A good analogy for Python programmers are functions and methods. Utility components, like Python functions, are standalone objects that do not need any other objects to do their work. Adapter components, like Python methods, require another object to work upon.

Utility components will mostly be used for simple, throw-away components that serve one simple task, like an XML parser.

Many components that were originally Zope 3 services have been converted into utility components.


About Service Components

A service is a standard facility provided by a component to other components. Services are a small set of core functionality provided by the Zope platform. These can be thought of as the "kernel" that Zope provides for your web applications. Services include user sessions, authentication, workflow, content-type management, and even managing your components themselves.

Recent Changes Printable View Page History Edit Page