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