5761l2 Listing 2. smallhello/smallhello.py import OFS.SimpleItem # Basic acquisition from Globals import HTMLFile # Lets us bring in an HTML file class smallhello(OFS.SimpleItem.SimpleItem): """This is the class that defines our smallhello product. We have a method for initialization (__init__), another that displays a brief HTML message by default, and a third that displays output from a DTML file.""" meta_type = 'smallhello' def __init__(self, id, title): "initialize a new instance of Smallhello" self.id = id self.title = title def index_html(self): "Show us some basic content!" return """ Hello, world!

Hello, world!

Welcome to my 'smallhello' Zope product

""" def other_html(self): "More basic content" return """ More content!

More content!

You can define lots of methods if you want...

""" def foo_file(self): "Demonstrate returning content from a file" return HTMLFile('foo', globals()) def manage_smallhello(self, RESPONSE): "Add a Smallhello to a folder." self._setObject('smallhello_id', smallhello('smallhello_id', 'smallhello_title')) RESPONSE.redirect('index_html')