"""The root directory for the Quixote demo. """ from quixote import get_response from quixote.directory import Directory from quixote.errors import PublishError from quixote.util import dump_request from quixote.demo.extras import ExtraDirectory class RootDirectory(Directory): _q_exports = ["", "simple", "plain", "error", "publish_error", "css", "dumpreq", "extras", ("favicon.ico", "favicon_ico")] def _q_index [html] (self): print "debug message from the index page" """ Quixote Demo

Hello, world!

To understand what's going on here, be sure to read the doc/demo.txt file included with Quixote.

Here are some features of this demo:

""" def simple [html] (self): 'Hello!' def plain(self): get_response().set_content_type("text/plain") return "This is a plain text document." def error(self): raise ValueError, "this is a Python exception" def publish_error(self): raise PublishError("Publishing error raised by publish_error") def dumpreq [html] (self): """ HTTPRequest Object

HTTPRequest Object

""" dump_request() """ """ def css(self): get_response().set_content_type("text/css") # on a real site we would also set the expires header return 'body { border: thick solid green; padding: 2em; }' def favicon_ico(self): response = get_response() response.set_content_type("image/x-icon") response.set_expires(days=1) return FAVICON extras = ExtraDirectory() FAVICON = """\ AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAADJZmEA4KilAMJQSwDZko8Aujo0AOi9uwDRfHgA9+npAP///wDw1NIAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAiIiIiIiIiIiIiIiIiIiIiIiIiIiSQDiIiIiIiGRYSIiIiIYkRFiIiIiFQlhk RYiIiIBAeGRAiIiIFEE2aUQYiIhkSHV4RGiIiGRIiIhEaIiIZEiIiERoiIiUSYiJRJiIiIZDiING iIiIh2RlEmeIiIiIiBYYiIiIiIiIiIiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA """.decode('base64')