1 #!/usr/bin/env python 2 3 "A simple application for test purposes." 4 5 import WebStack.Generic 6 7 class SimpleResource: 8 9 "A simple resource." 10 11 def respond(self, trans): 12 trans.set_content_type(WebStack.Generic.ContentType("text/html")) 13 14 # Get some information. 15 16 out = trans.get_response_stream() 17 out.write(""" 18 <html> 19 <body> 20 <h1>Test</h1> 21 <ul> 22 <li>Path: %s</li> 23 <li>Path info: %s</li> 24 <li>Request method: %s</li> 25 <li>Content type: %s</li> 26 <li>Charset: %s</li> 27 </ul> 28 </body> 29 </html> 30 """ % ( 31 trans.get_path(), 32 trans.get_path_info(), 33 trans.get_request_method(), 34 trans.get_content_type().content_type, 35 trans.get_content_type().charset, 36 )) 37 38 # vim: tabstop=4 expandtab shiftwidth=4