Acquisition is the technology that allows dynamic behavior and content to be passed between Zope objects.
Acquisition's flavor permeates Zope, and a basic understanding of acquisition is important for understanding Zope's power and how to harness it.
Acquisition is about Containment
The concept behind acquisition is simple:
- Objects are placed inside other objects.
- Objects acquire content and behavior from their containers.
That's it.
What's so powerful about Containment?
The powerful part about acquisition is how objects automatically gather services from their containers. What this means is that when you create Documents and Folders you're not just building a web site, you're building an information structure.
For example, when you place a Document inside a Folder you are creating a small information sharing facility between the Document and the Folder.
Why is this different from placing an HTML file inside a directory? Because in Zope, the Document has access to all its container's content and services. So if a Folder can send mail, any Document placed inside the Folder can also send mail.
Providing services
Not only do objects acquire services, they also provide them. For example, adding a Mail Host object to a Folder provides that Folder with the ability to send mail. Documents too can provide services to Folders. In fact every object provides some service.
So acquisition goes both ways, when you create an object in Zope it automatically acquires services, and it also automatically provides services that other objects can acquire. This makes reuse of services very easy since you don't have to do anything special to make services available to other objects.
No comments:
Post a Comment