1.1 --- a/examples/Common/Questionnaire/__init__.py Sun Jan 21 00:22:40 2007 +0000
1.2 +++ b/examples/Common/Questionnaire/__init__.py Sun Jan 21 00:23:27 2007 +0000
1.3 @@ -10,8 +10,13 @@
1.4 # Site map imports.
1.5
1.6 from WebStack.Resources.ResourceMap import MapResource
1.7 +from WebStack.Resources.Selectors import EncodingSelector
1.8 from WebStack.Resources.Static import DirectoryResource
1.9
1.10 +# Configuration settings.
1.11 +
1.12 +encoding = "utf-8"
1.13 +
1.14 # Resource classes.
1.15
1.16 class QuestionnaireEditorResource(XSLForms.Resources.WebResources.XSLFormsResource):
1.17 @@ -19,7 +24,6 @@
1.18 "A resource providing a questionnaire editor."
1.19
1.20 resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")
1.21 - encoding = "utf-8"
1.22 template_resources = {
1.23 "question" : ("question_template.xhtml", "question_output.xsl")
1.24 }
1.25 @@ -58,7 +62,7 @@
1.26 # When exported, an XML version of the data is returned.
1.27
1.28 if parameters.has_key("export"):
1.29 - trans.set_content_type(WebStack.Generic.ContentType("text/xml", self.encoding))
1.30 + trans.set_content_type(WebStack.Generic.ContentType("text/xml", encoding))
1.31 questionnaire.toStream(trans.get_response_stream(), trans.get_response_stream_encoding())
1.32
1.33 # When not exported, the data is transformed to produce a normal Web
1.34 @@ -68,7 +72,7 @@
1.35
1.36 # Start the response.
1.37
1.38 - trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", self.encoding))
1.39 + trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", encoding))
1.40
1.41 # Ensure that an output stylesheet exists.
1.42
1.43 @@ -98,7 +102,7 @@
1.44 "" : questionnaire_resource
1.45 })
1.46
1.47 - return resource
1.48 + return EncodingSelector(resource, encoding)
1.49
1.50 # Resource preparation ahead of time - useful for making installations.
1.51