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 path_info, path = "", "" 17 18 try: 19 path_info = trans.get_path_info() 20 path = trans.get_path() 21 except NotImplementedError: 22 pass 23 24 out = trans.get_response_stream() 25 out.write(""" 26 <html> 27 <body> 28 <h1>Test</h1> 29 <p> 30 Path: %s 31 </p> 32 <p> 33 Path info: %s 34 </p> 35 </body> 36 </html> 37 """ % (path, path_info)) 38 39 # vim: tabstop=4 expandtab shiftwidth=4