1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/ModPython/DictionaryApp/DictionaryHandler.py Fri Sep 09 17:33:19 2005 +0000
1.3 @@ -0,0 +1,30 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +# Initialise paths and the dictionary.
1.7 +# NOTE: Path manipulation requires manual customisation.
1.8 +
1.9 +import sys
1.10 +sys.path.append("/home/paulb/Software/Python/WebStack")
1.11 +sys.path.append("/home/paulb/Software/Python/XSLTools")
1.12 +sys.path.append("/home/paulb/Software/Python/XSLTools/examples/Common")
1.13 +sys.path.append("/home/paulb/Software/Python/libxml2dom")
1.14 +filename = "/home/paulb/Software/Python/XSLTools/docs/LICENCE.txt"
1.15 +encoding = None
1.16 +
1.17 +from WebStack.Adapters import ModPython
1.18 +import Dictionary
1.19 +from Dictionary.Dict import Dict
1.20 +
1.21 +dict = Dict(filename, encoding)
1.22 +
1.23 +# Get a simple Web site.
1.24 +
1.25 +resource = Dictionary.get_site(dict)
1.26 +
1.27 +# NOTE: Not sure if the resource should be maintained in a resource pool.
1.28 +
1.29 +def handler(req):
1.30 + global resource
1.31 + return ModPython.respond(req, resource, handle_errors=0)
1.32 +
1.33 +# vim: tabstop=4 expandtab shiftwidth=4