response.append(self.template % 'GET: <i>[no data input]</i>') def POST(self, request, response): try: msg = "Data posted: %s" % request.cgi_fields['data'].value.strip() except KeyError: msg = 'Data posted: <b>no input data provided!</b>' response['Content-Type'] = 'text/html' response.append(self.template % msg) application = Application() # Simple functions as processors application.add_map(r'^/?$', GET=home) application.add_map(r'^/conflict$', GET=conflict) # Processors can be chained by giving a list of them in 'add_map' application.add_map(r'^/login$', GET=[BasicAuthenticate(realm='example'), EchoProcessor()]) # A Dispatcher class for handling all methods for a URL application.add_dispatcher(r'^/page$', Dispatcher) # Using a predefined processor: a callable class instance application.add_map(r'^/file/.+$', GET=FileProcessor('/home/pjk/python', '/file')) # Example: catch all other URLs application.add_map(path_matcher, GET=path_echo)