SVN: r25672 - trunk/quixote/demo

Neil Schemenauer <nascheme-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Tue, 23 Nov 2004 12:20:57 -0500
Newsgroups gmane.comp.web.quixote.cvs
Message-ID <[email protected]>
Author: nascheme
Date: 2004-11-23 12:20:33 -0500 (Tue, 23 Nov 2004)
New Revision: 25672

Added:
   trunk/quixote/demo/mini_demo.py
Log:
Another demo.


Added: trunk/quixote/demo/mini_demo.py
===================================================================
--- trunk/quixote/demo/mini_demo.py	2004-11-23 16:07:24 UTC (rev 25671)
+++ trunk/quixote/demo/mini_demo.py	2004-11-23 17:20:33 UTC (rev 25672)
@@ -0,0 +1,40 @@
+"""$URL$
+$Id$
+
+A minimal Quixote demo.  If you have the 'quixote' package in your Python
+path, you can run it like this:
+
+  $ python demo/mini_demo.py
+
+The server listens on localhost:8080 by default.  Debug and error output
+will be sent to the terminal.
+"""
+
+from quixote.publish import Publisher
+from quixote.directory import Directory
+
+class RootDirectory(Directory):
+
+    _q_exports = ['', 'hello']
+
+    def _q_index(self):
+        return '''<html>
+                    <body>Welcome to the Quixote demo.  Here is a
+                    <a href="hello">link</a>.
+                    </body>
+                  </html>
+                '''
+
+    def hello(self):
+        return '<html><body>Hello world!</body></html>'
+
+
+def create_publisher():
+    return Publisher(RootDirectory(),
+                     display_exceptions='plain')
+
+
+if __name__ == '__main__':
+    from quixote.server.simple_server import run
+    print 'creating demo listening on http://localhost:8080/'
+    run(create_publisher, host='localhost', port=8080)


Property changes on: trunk/quixote/demo/mini_demo.py
___________________________________________________________________
Name: svn:keywords
   + HeadURL Id