# HG changeset patch # User paulb # Date 1093650783 0 # Node ID a1e815930f7a4797219ef5ee265e0cfc73d85647 # Parent 49ef2c165fd5cf73fac9fc4027b666126649d64b [project @ 2004-08-27 23:53:03 by paulb] Added the form example. diff -r 49ef2c165fd5 -r a1e815930f7a examples/Zope/FormProduct/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/Zope/FormProduct/__init__.py Fri Aug 27 23:53:03 2004 +0000 @@ -0,0 +1,51 @@ +#!/usr/bin/env python + +"A Zope product testing forms." + +from Form import FormResource +from WebStack.Adapters.Zope import WebStackAdapterProduct +from Globals import InitializeClass + +class FormProduct(WebStackAdapterProduct): + meta_type = "Form product" + def __init__(self, id): + WebStackAdapterProduct.__init__(self, id, FormResource()) + +InitializeClass(FormProduct) + +def addFormProduct(self): + """ + The HTML form used to add the product. + """ + + return """ + + + Add Form Product + + +
+ id
+ +
+ + + """ + +def addProduct(self, id, REQUEST=None): + """ + The function used to add the product. + """ + + product = FormProduct(id) + self.Destination()._setObject(id, product) + if REQUEST: + return self.manage_main(self, REQUEST) + +def initialize(context): + context.registerClass( + FormProduct, + constructors = (addFormProduct, addProduct) + ) + +# vim: tabstop=4 expandtab shiftwidth=4