1 #!/usr/bin/env python 2 3 "A Zope product which tests Unicode output." 4 5 from Unicode import UnicodeResource 6 from WebStack.Adapters.Zope import WebStackAdapterProduct 7 from Globals import InitializeClass 8 9 class UnicodeProduct(WebStackAdapterProduct): 10 meta_type = "Unicode product" 11 def __init__(self, id): 12 WebStackAdapterProduct.__init__(self, id, UnicodeResource()) 13 14 InitializeClass(UnicodeProduct) 15 16 def addUnicodeProduct(self): 17 """ 18 The HTML form used to add the product. 19 """ 20 21 return """ 22 <html> 23 <head> 24 <title>Add Unicode Product</title> 25 </head> 26 <body> 27 <form action="addProduct"> 28 id <input name="id" type="text"><br> 29 <input name="add" type="submit" value="Add!"> 30 </form> 31 </body> 32 </html> 33 """ 34 35 def addProduct(self, id, REQUEST=None): 36 """ 37 The function used to add the product. 38 """ 39 40 product = UnicodeProduct(id) 41 self.Destination()._setObject(id, product) 42 if REQUEST: 43 return self.manage_main(self, REQUEST) 44 45 def initialize(context): 46 context.registerClass( 47 UnicodeProduct, 48 constructors = (addUnicodeProduct, addProduct) 49 ) 50 51 # vim: tabstop=4 expandtab shiftwidth=4