1.1 --- a/examples/BaseHTTPRequestHandler/QuestionnaireApp.py Thu Jul 14 22:52:50 2005 +0000
1.2 +++ b/examples/BaseHTTPRequestHandler/QuestionnaireApp.py Thu Jul 14 22:53:21 2005 +0000
1.3 @@ -1,11 +1,28 @@
1.4 #!/usr/bin/env python
1.5
1.6 from WebStack.Adapters.BaseHTTPRequestHandler import deploy
1.7 +from WebStack.Resources.ResourceMap import MapResource
1.8 +from WebStack.Resources.Static import DirectoryResource
1.9 from Questionnaire import QuestionnaireEditorResource
1.10 +import os
1.11 +
1.12 +# Get the directory of the application.
1.13 +
1.14 +questionnaire_resource = QuestionnaireEditorResource()
1.15 +directory = questionnaire_resource.resource_dir
1.16 +
1.17 +# Make a simple Web site.
1.18 +
1.19 +resource = MapResource({
1.20 + # Static resources:
1.21 + "styles" : DirectoryResource(os.path.join(directory, "styles"), {"css" : "text/css"}),
1.22 + # Main page:
1.23 + "" : questionnaire_resource
1.24 + })
1.25
1.26 # Special magic incantation.
1.27
1.28 print "Serving..."
1.29 -deploy(QuestionnaireEditorResource(), handle_errors=0)
1.30 +deploy(resource, handle_errors=0)
1.31
1.32 # vim: tabstop=4 expandtab shiftwidth=4