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