# HG changeset patch # User paulb # Date 1093786635 0 # Node ID 0c7ae3d1bbc0b64bd7e0869677905f57d758f127 # Parent 1724fcb3d273dba4dcbbbece3e9c3fa55eaf6722 [project @ 2004-08-29 13:37:15 by paulb] Added the cookies example. diff -r 1724fcb3d273 -r 0c7ae3d1bbc0 examples/Zope/CookiesProduct/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/Zope/CookiesProduct/__init__.py Sun Aug 29 13:37:15 2004 +0000 @@ -0,0 +1,51 @@ +#!/usr/bin/env python + +"A Zope product which tests cookie handling." + +from Cookies import CookiesResource +from WebStack.Adapters.Zope import WebStackAdapterProduct +from Globals import InitializeClass + +class CookiesProduct(WebStackAdapterProduct): + meta_type = "Cookies product" + def __init__(self, id): + WebStackAdapterProduct.__init__(self, id, CookiesResource()) + +InitializeClass(CookiesProduct) + +def addCookiesProduct(self): + """ + The HTML form used to add the product. + """ + + return """ + + + Add Cookies Product + + +
+ id
+ +
+ + + """ + +def addProduct(self, id, REQUEST=None): + """ + The function used to add the product. + """ + + product = CookiesProduct(id) + self.Destination()._setObject(id, product) + if REQUEST: + return self.manage_main(self, REQUEST) + +def initialize(context): + context.registerClass( + CookiesProduct, + constructors = (addCookiesProduct, addProduct) + ) + +# vim: tabstop=4 expandtab shiftwidth=4