# HG changeset patch # User paulb # Date 1114971412 0 # Node ID 74ed715c5455a3d0ebfac015475fc58add3e1d6d # Parent 0cf5a951e9d113589d6685d0a239d1b35ccc5d23 [project @ 2005-05-01 18:16:52 by paulb] Added missing example for Zope. diff -r 0cf5a951e9d1 -r 74ed715c5455 examples/Zope/CalendarProduct/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/Zope/CalendarProduct/__init__.py Sun May 01 18:16:52 2005 +0000 @@ -0,0 +1,51 @@ +#!/usr/bin/env python + +"A Zope calendar product." + +from Calendar import DirectoryResource +from WebStack.Adapters.Zope import WebStackAdapterProduct +from Globals import InitializeClass + +class CalendarProduct(WebStackAdapterProduct): + meta_type = "Calendar product" + def __init__(self, id): + WebStackAdapterProduct.__init__(self, id, DirectoryResource()) + +InitializeClass(CalendarProduct) + +def addCalendarProduct(self): + """ + The HTML form used to add the product. + """ + + return """ + + + Add Calendar Product + + +
+ id
+ +
+ + + """ + +def addProduct(self, id, REQUEST=None): + """ + The function used to add the product. + """ + + product = CalendarProduct(id) + self.Destination()._setObject(id, product) + if REQUEST: + return self.manage_main(self, REQUEST) + +def initialize(context): + context.registerClass( + CalendarProduct, + constructors = (addCalendarProduct, addProduct) + ) + +# vim: tabstop=4 expandtab shiftwidth=4