1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/Common/Simple/__init__.py Sat Feb 07 23:49:18 2004 +0000
1.3 @@ -0,0 +1,38 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +"A simple application for test purposes."
1.7 +
1.8 +import WebStack.Generic
1.9 +
1.10 +class SimpleResource:
1.11 +
1.12 + "A simple resource."
1.13 +
1.14 + def respond(self, trans):
1.15 + trans.set_content_type(WebStack.Generic.ContentType("text/html"))
1.16 +
1.17 + # Get some information.
1.18 +
1.19 + out = trans.get_response_stream()
1.20 + out.write("""
1.21 +<html>
1.22 + <body>
1.23 + <h1>Test</h1>
1.24 + <ul>
1.25 + <li>Path: %s</li>
1.26 + <li>Path info: %s</li>
1.27 + <li>Request method: %s</li>
1.28 + <li>Content type: %s</li>
1.29 + <li>Charset: %s</li>
1.30 + </ul>
1.31 + </body>
1.32 +</html>
1.33 +""" % (
1.34 + trans.get_path(),
1.35 + trans.get_path_info(),
1.36 + trans.get_request_method(),
1.37 + trans.get_content_type().content_type,
1.38 + trans.get_content_type().charset,
1.39 +))
1.40 +
1.41 +# vim: tabstop=4 expandtab shiftwidth=4