Previous Chapter | Next Chapter | Up | Next Section | Contents

Creating Methods


A class's heavy lifting is done by its methods. In addition to defining a property schema, your main task in crafting a Z Class will be to build a collection of methods which manipulate your class's properties and do useful work.

To create methods for your class, you simply create objects in the "Methods" tab management view. For the most part your methods will consist of DTML Method objects, SQL Method objects and External Method objects. These Zope objects will provide all instances of your class with services just as they would provide services to their enclosing Folders if they were not defined as Z Class methods. In other words, there is nothing new or unusual about method objects; they are simply made available to class instances through the Z Class rather than through acquisition.

One useful method to create is the special index_html method which is used to display an object when called from the web. Just as Folders manage their default view with an "index_html" object, so you can control the default representation of your class. For example our CD class might define a DTML Method with Id "index_html" like so:

<dtml-var standard_html_header>

<h1>CD</h1>

<p>Title: <dtml-var title></p>

<p>Artist: <dtml-var artist></p>

<p>Description: <dtml-var description html_quote newline_to_br></p>

<dtml-var standard_html_footer>

Methods which you wish to be accessible through the web and DTML, need to be mapped to permissions. See Creating and Managing Permissions.

Previous Chapter | Next Chapter | Up | Next Section | Contents

Banner.Novgorod.Ru