# HG changeset patch # User paulb # Date 1121538363 0 # Node ID 470103644a033d4e906f95f9881da9032e4811ed # Parent 110e812926b32b08b385b87037eac6063fdeec4f [project @ 2005-07-16 18:25:59 by paulb] Moved site map initialisation into the applications. diff -r 110e812926b3 -r 470103644a03 examples/Common/PEP241/__init__.py --- a/examples/Common/PEP241/__init__.py Sat Jul 16 18:25:53 2005 +0000 +++ b/examples/Common/PEP241/__init__.py Sat Jul 16 18:26:03 2005 +0000 @@ -8,6 +8,13 @@ import XSLOutput import os +# Site map imports. + +from WebStack.Resources.ResourceMap import MapResource +from WebStack.Resources.Static import DirectoryResource + +# Resource classes. + class PEP241Resource(XSLForms.Resources.XSLFormsResource): "A resource providing repository browsing." @@ -80,4 +87,26 @@ self.send_output(trans, [trans_xsl], package) +# Site map initialisation. + +def get_site(): + + "Return a simple Web site resource." + + # Get the main resource and the directory used by the application. + + pep241_resource = PEP241Resource() + directory = pep241_resource.resource_dir + + # Make a simple Web site. + + resource = MapResource({ + # Static resources: + "styles" : DirectoryResource(os.path.join(directory, "styles"), {"css" : "text/css"}), + # Main page: + "" : pep241_resource + }) + + return resource + # vim: tabstop=4 expandtab shiftwidth=4 diff -r 110e812926b3 -r 470103644a03 examples/Common/Questionnaire/__init__.py --- a/examples/Common/Questionnaire/__init__.py Sat Jul 16 18:25:53 2005 +0000 +++ b/examples/Common/Questionnaire/__init__.py Sat Jul 16 18:26:03 2005 +0000 @@ -7,6 +7,13 @@ import XSLForms.Utils import os +# Site map imports. + +from WebStack.Resources.ResourceMap import MapResource +from WebStack.Resources.Static import DirectoryResource + +# Resource classes. + class QuestionnaireEditorResource(XSLForms.Resources.XSLFormsResource): "A resource providing a questionnaire editor." @@ -71,4 +78,26 @@ self.send_output(trans, [trans_xsl], questionnaire) +# Site map initialisation. + +def get_site(): + + "Return a simple Web site resource." + + # Get the main resource and the directory used by the application. + + questionnaire_resource = QuestionnaireEditorResource() + directory = questionnaire_resource.resource_dir + + # Make a simple Web site. + + resource = MapResource({ + # Static resources: + "styles" : DirectoryResource(os.path.join(directory, "styles"), {"css" : "text/css"}), + # Main page: + "" : questionnaire_resource + }) + + return resource + # vim: tabstop=4 expandtab shiftwidth=4