# HG changeset patch # User paulb # Date 1095613973 0 # Node ID 5a33a1d61f0b6ba729eaf17993f3478f27848cad # Parent 2f11271cbe1cd43d9ce1f93f2ba7b37defc65c36 [project @ 2004-09-19 17:12:53 by paulb] Added the Auth example. diff -r 2f11271cbe1c -r 5a33a1d61f0b examples/Zope/AuthProduct/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/Zope/AuthProduct/__init__.py Sun Sep 19 17:12:53 2004 +0000 @@ -0,0 +1,51 @@ +#!/usr/bin/env python + +"A Zope product which tests authentication." + +from Auth import AuthResource, AuthAuthenticator +from WebStack.Adapters.Zope import WebStackAdapterProduct +from Globals import InitializeClass + +class AuthProduct(WebStackAdapterProduct): + meta_type = "Auth product" + def __init__(self, id): + WebStackAdapterProduct.__init__(self, id, AuthResource(), AuthAuthenticator()) + +InitializeClass(AuthProduct) + +def addAuthProduct(self): + """ + The HTML form used to add the product. + """ + + return """ + + + Add Auth Product + + +
+ id
+ +
+ + + """ + +def addProduct(self, id, REQUEST=None): + """ + The function used to add the product. + """ + + product = AuthProduct(id) + self.Destination()._setObject(id, product) + if REQUEST: + return self.manage_main(self, REQUEST) + +def initialize(context): + context.registerClass( + AuthProduct, + constructors = (addAuthProduct, addProduct) + ) + +# vim: tabstop=4 expandtab shiftwidth=4