You are not logged in Log in Join
You are here: Home » Members » Amos's Zope Page » What is Object Publishing?

Log in
Name

Password

 

What is Object Publishing?

Zope is an "object publishing environment". But what exactly does this mean?

Dynamic Content

Object publishing allows you to create dynamic content.

Unlike HTML pages or CGI programs, Zope views a web application in terms of objects. Objects are little bundles of content and behavior. Zope allows you to wire objects together to create powerful and flexible collections of objects. These object collections respond dynamically to web requests. The result is dynamic content.

This is pretty different from the way web sites are normally created. Putting a bunch of HTML pages and CGI scripts together to create a web site does not create any synergy. HTML pages and CGI scripts do not behave any differently when they are collected in a web site. HTML pages still deliver the same static content, and CGI scripts still do the same processing. The elements of the site do not communicate and when you change one of the elements you need to manually update the others.

Not so with Zope. Every Zope object is smart in the sense that is adaptable and can communicate with other objects. Zope objects work together. Objects acquire information and behavior from other objects. The way you wire your objects together determines what services and content are available to them. (See What is Acquisition? for more information.) Objects then represent themselves appropriately given their context and content. This is the publishing process.

URLs refer to Objects

So how is a Zope object published? By requesting a URL.

To refer to an object in Zope you use a URL. This is very similar to how a web server refers to HTML files. Here's an example URL:

    http://www.example.com/Users/Barney/Song

To a normal web server this URL means return the file named Song inside the Barney directory inside the Users directory. To Zope this means publish the object named Song inside the object named Barney inside the object named Users.

So what's the difference?

With Zope every object is dynamic, so for example if the Song object can be sung in different ways, you can just add additional information to the URL requesting a different behavior. For example:

    http://www.example.com/Users/Barney/Song/sing?audience=children&repeat:int=5

This URL tells Zope to publish the Song object by calling its sing method with the arguments (audience="children",repeat=5).

In addition, context influences how objects are published. So in our example, the Users object might define an HTML header and footer, and the Barney object might define all text to be green. So when the Song object publishes itself, the fact that it is inside the Barney and the Users objects results in its song being displayed in green text with a standard HTML header and footer. If you move the Song object to another location, it will be displayed differently given its different context.

Every Zope object is dynamic, and can be published in different ways to reveal different behavior.