1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/CGI/ConfiguratorApp.py Sat Jul 16 15:04:11 2005 +0000
1.3 @@ -0,0 +1,40 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +# NOTE: Path manipulation requires manual customisation.
1.7 +
1.8 +import sys
1.9 +sys.path.append("/home/paulb/Software/Python/WebStack")
1.10 +sys.path.append("/home/paulb/Software/Python/XSLTools")
1.11 +sys.path.append("/home/paulb/Software/Python/XSLTools/examples/Common")
1.12 +sys.path.append("/home/paulb/Software/Python/libxml2dom")
1.13 +
1.14 +from WebStack.Adapters.CGI import deploy
1.15 +from WebStack.Resources.ResourceMap import MapResource
1.16 +from WebStack.Resources.Static import DirectoryResource
1.17 +import Configurator
1.18 +import os
1.19 +
1.20 +# Get the directory of the application.
1.21 +
1.22 +configurator_resource = Configurator.ConfiguratorResource()
1.23 +directory = configurator_resource.resource_dir
1.24 +
1.25 +# Make a simple Web site.
1.26 +
1.27 +resource = MapResource({
1.28 + # Static resources:
1.29 + "styles" : DirectoryResource(os.path.join(directory, "styles"), {"css" : "text/css"}),
1.30 + "scripts" : DirectoryResource(os.path.join(directory, "scripts"), {"js" : "text/javascript"}),
1.31 + # Main page:
1.32 + "" : configurator_resource,
1.33 + # Fragments:
1.34 + "cpu" : configurator_resource,
1.35 + "memory" : configurator_resource,
1.36 + "hard-disks" : configurator_resource
1.37 + })
1.38 +
1.39 +# Special magic incantation.
1.40 +
1.41 +deploy(resource, handle_errors=0)
1.42 +
1.43 +# vim: tabstop=4 expandtab shiftwidth=4