1.1 --- a/XSLForms/Resources/PyQtWebResources.py Sun Jan 21 00:22:40 2007 +0000
1.2 +++ b/XSLForms/Resources/PyQtWebResources.py Sun Jan 21 00:23:27 2007 +0000
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 PyQt-compatible resources for use with WebStack.
1.6
1.7 -Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2005, 2007 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This library is free software; you can redistribute it and/or
1.11 modify it under the terms of the GNU Lesser General Public
1.12 @@ -35,6 +35,7 @@
1.13 with WebStack.
1.14 """
1.15
1.16 + encoding = "utf-8"
1.17 widget_resources = {}
1.18
1.19 def __init__(self, design_identifier):
2.1 --- a/XSLForms/Resources/WebResources.py Sun Jan 21 00:22:40 2007 +0000
2.2 +++ b/XSLForms/Resources/WebResources.py Sun Jan 21 00:23:27 2007 +0000
2.3 @@ -3,7 +3,7 @@
2.4 """
2.5 Resources for use with WebStack.
2.6
2.7 -Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk>
2.8 +Copyright (C) 2005, 2006, 2007 Paul Boddie <paul@boddie.org.uk>
2.9
2.10 This library is free software; you can redistribute it and/or
2.11 modify it under the terms of the GNU Lesser General Public
2.12 @@ -79,8 +79,8 @@
2.13 bodies
2.14 """
2.15
2.16 - path_encoding = "utf-8"
2.17 - encoding = "utf-8"
2.18 + #path_encoding = "utf-8"
2.19 + #encoding = "utf-8"
2.20 template_resources = {}
2.21 in_page_resources = {}
2.22 init_resources = {}
2.23 @@ -236,7 +236,10 @@
2.24 'trans'.
2.25 """
2.26
2.27 - return trans.get_path_info(self.path_encoding).split("/")[-1]
2.28 + if hasattr(self, "path_encoding"):
2.29 + return trans.get_path_info(self.path_encoding).split("/")[-1]
2.30 + else:
2.31 + return trans.get_path_info().split("/")[-1]
2.32
2.33 def respond(self, trans):
2.34
2.35 @@ -255,21 +258,20 @@
2.36 if method == "GET":
2.37
2.38 # Get the fields from the request path (URL).
2.39 - # NOTE: The encoding is actually redundant since WebStack produces
2.40 - # NOTE: Unicode values.
2.41
2.42 - form = XSLForms.Fields.Form(encoding=self.path_encoding, values_are_lists=1)
2.43 + form = XSLForms.Fields.Form(encoding=None, values_are_lists=1)
2.44 parameters = trans.get_fields_from_path()
2.45 form.set_parameters(parameters)
2.46
2.47 elif method == "POST" and content_type.media_type == "application/x-www-form-urlencoded":
2.48
2.49 # Get the fields from the request body.
2.50 - # NOTE: The encoding is actually redundant since WebStack produces
2.51 - # NOTE: Unicode values.
2.52
2.53 - form = XSLForms.Fields.Form(encoding=self.encoding, values_are_lists=1)
2.54 - parameters = trans.get_fields_from_body(self.encoding)
2.55 + form = XSLForms.Fields.Form(encoding=None, values_are_lists=1)
2.56 + if hasattr(self, "encoding"):
2.57 + parameters = trans.get_fields_from_body(self.encoding)
2.58 + else:
2.59 + parameters = trans.get_fields_from_body()
2.60
2.61 # NOTE: Konqueror workaround.
2.62 self.clean_parameters(parameters)
2.63 @@ -280,7 +282,7 @@
2.64
2.65 # Initialise empty container.
2.66
2.67 - form = XSLForms.Fields.Form(encoding=self.encoding, values_are_lists=1)
2.68 + form = XSLForms.Fields.Form(encoding=None, values_are_lists=1)
2.69
2.70 # Call an overridden method with the processed request information.
2.71
3.1 --- a/examples/Common/Candidate/__init__.py Sun Jan 21 00:22:40 2007 +0000
3.2 +++ b/examples/Common/Candidate/__init__.py Sun Jan 21 00:23:27 2007 +0000
3.3 @@ -12,8 +12,13 @@
3.4 # Site map imports.
3.5
3.6 from WebStack.Resources.ResourceMap import MapResource
3.7 +from WebStack.Resources.Selectors import EncodingSelector
3.8 from WebStack.Resources.Static import DirectoryResource
3.9
3.10 +# Configuration setting.
3.11 +
3.12 +encoding = "utf-8"
3.13 +
3.14 # Resource classes.
3.15
3.16 class AdminResource(XSLForms.Resources.WebResources.XSLFormsResource):
3.17 @@ -21,7 +26,6 @@
3.18 "A resource providing administration facilities for job candidate profiles."
3.19
3.20 resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")
3.21 - encoding = "utf-8"
3.22 template_resources = {
3.23 "admin" : ("admin_template.xhtml", "admin_output.xsl")
3.24 }
3.25 @@ -45,9 +49,9 @@
3.26 # Get the "show" and "edit" resource paths.
3.27 # NOTE: These should be obtained from the site map.
3.28
3.29 - vpath = trans.get_processed_virtual_path_info(self.path_encoding)
3.30 - show_path = trans.get_path_without_info(self.path_encoding) + trans.update_path(vpath, "show")
3.31 - edit_path = trans.get_path_without_info(self.path_encoding) + trans.update_path(vpath, "edit")
3.32 + vpath = trans.get_processed_virtual_path_info()
3.33 + show_path = trans.get_path_without_info() + trans.update_path(vpath, "show")
3.34 + edit_path = trans.get_path_without_info() + trans.update_path(vpath, "edit")
3.35
3.36 # Ensure the presence of a document.
3.37
3.38 @@ -63,12 +67,12 @@
3.39 selectors = form.get_selectors()
3.40 if selectors.has_key("show"):
3.41 name = selectors["show"][0].getAttribute("name")
3.42 - trans.redirect(trans.encode_path(show_path, self.path_encoding) +
3.43 - "?name=%s" % trans.encode_path(name, self.path_encoding))
3.44 + trans.redirect(trans.encode_path(show_path) +
3.45 + "?name=%s" % trans.encode_path(name))
3.46 elif selectors.has_key("edit"):
3.47 name = selectors["edit"][0].getAttribute("name")
3.48 - trans.redirect(trans.encode_path(edit_path, self.path_encoding) +
3.49 - "?name=%s" % trans.encode_path(name, self.path_encoding))
3.50 + trans.redirect(trans.encode_path(edit_path) +
3.51 + "?name=%s" % trans.encode_path(name))
3.52
3.53 # Add and remove elements according to the selectors found.
3.54
3.55 @@ -97,7 +101,7 @@
3.56
3.57 # Start the response.
3.58
3.59 - trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", self.encoding))
3.60 + trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", encoding))
3.61
3.62 # Ensure that an output stylesheet exists.
3.63
3.64 @@ -113,7 +117,6 @@
3.65 "A resource providing editing facilities for a job candidate profile."
3.66
3.67 resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")
3.68 - encoding = "utf-8"
3.69 template_resources = {
3.70 "candidate_display" : ("candidate_display_template.xhtml", "candidate_display_output.xsl")
3.71 }
3.72 @@ -136,7 +139,7 @@
3.73
3.74 parameters = form.get_parameters()
3.75 documents = form.get_documents()
3.76 - fields = trans.get_fields_from_path(self.path_encoding)
3.77 + fields = trans.get_fields_from_path()
3.78 name = fields.get("name", [u"None"])[0]
3.79
3.80 # Ensure the presence of a document.
3.81 @@ -157,7 +160,7 @@
3.82
3.83 # Start the response.
3.84
3.85 - trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", self.encoding))
3.86 + trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", encoding))
3.87
3.88 # Ensure that an output stylesheet exists.
3.89 # Handle the "show" operation.
3.90 @@ -174,7 +177,6 @@
3.91 "A resource providing editing facilities for a job candidate profile."
3.92
3.93 resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")
3.94 - encoding = "utf-8"
3.95 template_resources = {
3.96 "candidate" : ("candidate_template.xhtml", "candidate_output.xsl")
3.97 }
3.98 @@ -197,15 +199,15 @@
3.99
3.100 parameters = form.get_parameters()
3.101 documents = form.get_documents()
3.102 - fields = trans.get_fields_from_path(self.path_encoding)
3.103 + fields = trans.get_fields_from_path()
3.104 name = fields.get("name", [u"None"])[0]
3.105
3.106 # Get the "show" resource path.
3.107 # NOTE: This should be obtained from the site map.
3.108
3.109 - vpath = trans.get_processed_virtual_path_info(self.path_encoding)
3.110 - show_path = trans.get_path_without_info(self.path_encoding) + trans.update_path(vpath, "show")
3.111 - admin_path = trans.get_path_without_info(self.path_encoding) + trans.update_path(vpath, "")
3.112 + vpath = trans.get_processed_virtual_path_info()
3.113 + show_path = trans.get_path_without_info() + trans.update_path(vpath, "show")
3.114 + admin_path = trans.get_path_without_info() + trans.update_path(vpath, "")
3.115
3.116 # Ensure the presence of a document.
3.117
3.118 @@ -238,8 +240,8 @@
3.119 # Save the candidate information.
3.120
3.121 self.repository["candidate-%s" % name] = candidate.toString()
3.122 - trans.redirect(trans.encode_path(show_path, self.path_encoding) +
3.123 - "?name=%s" % trans.encode_path(name, self.path_encoding))
3.124 + trans.redirect(trans.encode_path(show_path) +
3.125 + "?name=%s" % trans.encode_path(name))
3.126
3.127 # Redirect if the administration interface is to be used.
3.128
3.129 @@ -248,11 +250,11 @@
3.130 # Save the candidate information.
3.131
3.132 self.repository["candidate-%s" % name] = candidate.toString()
3.133 - trans.redirect(trans.encode_path(admin_path, self.path_encoding))
3.134 + trans.redirect(trans.encode_path(admin_path))
3.135
3.136 # Start the response.
3.137
3.138 - trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", self.encoding))
3.139 + trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", encoding))
3.140
3.141 # Ensure that an output stylesheet exists.
3.142
3.143 @@ -289,7 +291,7 @@
3.144 "" : admin_resource
3.145 })
3.146
3.147 - return resource
3.148 + return EncodingSelector(resource, encoding)
3.149
3.150 # Resource preparation ahead of time - useful for making installations.
3.151
4.1 --- a/examples/Common/Configurator/__init__.py Sun Jan 21 00:22:40 2007 +0000
4.2 +++ b/examples/Common/Configurator/__init__.py Sun Jan 21 00:23:27 2007 +0000
4.3 @@ -10,8 +10,13 @@
4.4 # Site map imports.
4.5
4.6 from WebStack.Resources.ResourceMap import MapResource
4.7 +from WebStack.Resources.Selectors import EncodingSelector
4.8 from WebStack.Resources.Static import DirectoryResource
4.9
4.10 +# Configuration settings.
4.11 +
4.12 +encoding = "utf-8"
4.13 +
4.14 # Resource classes.
4.15
4.16 class ConfiguratorResource(XSLForms.Resources.WebResources.XSLFormsResource):
4.17 @@ -19,7 +24,6 @@
4.18 "A resource providing a system configurator."
4.19
4.20 resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")
4.21 - encoding = "utf-8"
4.22 template_resources = {
4.23 "configuration" : ("config_template.xhtml", "config_output.xsl")
4.24 }
4.25 @@ -83,7 +87,7 @@
4.26 # When exported, an XML version of the data is returned.
4.27
4.28 if parameters.has_key("export"):
4.29 - trans.set_content_type(WebStack.Generic.ContentType("text/xml", self.encoding))
4.30 + trans.set_content_type(WebStack.Generic.ContentType("text/xml", encoding))
4.31 configuration.toStream(trans.get_response_stream(), trans.get_response_stream_encoding())
4.32
4.33 # When not exported, the data is transformed to produce a normal Web
4.34 @@ -114,7 +118,7 @@
4.35
4.36 # Start the response.
4.37
4.38 - trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", self.encoding))
4.39 + trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", encoding))
4.40
4.41 # Ensure that an output stylesheet exists.
4.42
4.43 @@ -166,7 +170,7 @@
4.44 "accessories" : configurator_resource
4.45 })
4.46
4.47 - return resource
4.48 + return EncodingSelector(resource, encoding)
4.49
4.50 # Resource preparation ahead of time - useful for making installations.
4.51
5.1 --- a/examples/Common/DemoApp.py Sun Jan 21 00:22:40 2007 +0000
5.2 +++ b/examples/Common/DemoApp.py Sun Jan 21 00:23:27 2007 +0000
5.3 @@ -25,6 +25,13 @@
5.4
5.5 from WebStack.Generic import ContentType
5.6
5.7 +# Configuration settings.
5.8 +# NOTE: Change the filesystem encoding if appropriate.
5.9 +
5.10 +fsencoding = "iso-8859-15"
5.11 +
5.12 +# Resource classes.
5.13 +
5.14 class DemoResource:
5.15 def respond(self, trans):
5.16 trans.set_content_type(ContentType("text/html"))
5.17 @@ -71,11 +78,10 @@
5.18
5.19 resource = MapResource({
5.20
5.21 - # NOTE: Change the filesystem encoding if appropriate.
5.22 # Use the current working directory so that the installed package can still run
5.23 # the demo.
5.24
5.25 - "candidate" : Candidate.get_site("iso-8859-15", use_cwd=1),
5.26 + "candidate" : Candidate.get_site(fsencoding, use_cwd=1),
5.27 "configurator" : Configurator.get_site(),
5.28 "dictionary" : Dictionary.get_site(dict),
5.29 "questionnaire" : Questionnaire.get_site(),
6.1 --- a/examples/Common/Dictionary/__init__.py Sun Jan 21 00:22:40 2007 +0000
6.2 +++ b/examples/Common/Dictionary/__init__.py Sun Jan 21 00:23:27 2007 +0000
6.3 @@ -10,8 +10,13 @@
6.4 # Site map imports.
6.5
6.6 from WebStack.Resources.ResourceMap import MapResource
6.7 +from WebStack.Resources.Selectors import EncodingSelector
6.8 from WebStack.Resources.Static import DirectoryResource
6.9
6.10 +# Configuration setting.
6.11 +
6.12 +encoding = "utf-8"
6.13 +
6.14 # Resource classes.
6.15
6.16 class DictionaryResource(XSLForms.Resources.WebResources.XSLFormsResource):
6.17 @@ -19,7 +24,6 @@
6.18 "A simple resource providing dictionary lookup."
6.19
6.20 resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")
6.21 - encoding = "utf-8"
6.22 template_resources = {
6.23 "words" : ("words_template.xhtml", "words_output.xsl")
6.24 }
6.25 @@ -111,7 +115,7 @@
6.26
6.27 # Start the response.
6.28
6.29 - trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", self.encoding))
6.30 + trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", encoding))
6.31
6.32 # Ensure that an output stylesheet exists.
6.33
6.34 @@ -154,7 +158,7 @@
6.35 "matches" : dictionary_resource
6.36 })
6.37
6.38 - return resource
6.39 + return EncodingSelector(resource, encoding)
6.40
6.41 # Resource preparation ahead of time - useful for making installations.
6.42
7.1 --- a/examples/Common/PEP241/__init__.py Sun Jan 21 00:22:40 2007 +0000
7.2 +++ b/examples/Common/PEP241/__init__.py Sun Jan 21 00:23:27 2007 +0000
7.3 @@ -10,8 +10,13 @@
7.4 # Site map imports.
7.5
7.6 from WebStack.Resources.ResourceMap import MapResource
7.7 +from WebStack.Resources.Selectors import EncodingSelector
7.8 from WebStack.Resources.Static import DirectoryResource
7.9
7.10 +# Configuration setting.
7.11 +
7.12 +encoding = "utf-8"
7.13 +
7.14 # Resource classes.
7.15
7.16 class PEP241Resource(XSLForms.Resources.WebResources.XSLFormsResource):
7.17 @@ -19,7 +24,6 @@
7.18 "A resource providing repository browsing."
7.19
7.20 resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")
7.21 - encoding = "utf-8"
7.22 template_resources = {
7.23 "pep241" : ("pep241_template.xhtml", "pep241_output.xsl")
7.24 }
7.25 @@ -73,7 +77,7 @@
7.26 # When exported, an XML version of the data is returned.
7.27
7.28 if parameters.has_key("export"):
7.29 - trans.set_content_type(WebStack.Generic.ContentType("text/xml", self.encoding))
7.30 + trans.set_content_type(WebStack.Generic.ContentType("text/xml", encoding))
7.31 package.toStream(trans.get_response_stream(), trans.get_response_stream_encoding())
7.32
7.33 # When not exported, the data is transformed to produce a normal Web
7.34 @@ -89,7 +93,7 @@
7.35
7.36 # Start the response.
7.37
7.38 - trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", self.encoding))
7.39 + trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", encoding))
7.40
7.41 # Ensure that an output stylesheet exists.
7.42
7.43 @@ -136,7 +140,7 @@
7.44 "" : pep241_resource
7.45 })
7.46
7.47 - return resource
7.48 + return EncodingSelector(resource, encoding)
7.49
7.50 # Resource preparation ahead of time - useful for making installations.
7.51
8.1 --- a/examples/Common/QtConfigurator/__init__.py Sun Jan 21 00:22:40 2007 +0000
8.2 +++ b/examples/Common/QtConfigurator/__init__.py Sun Jan 21 00:23:27 2007 +0000
8.3 @@ -211,8 +211,13 @@
8.4 else:
8.5 import XSLForms.Resources.PyQtWebResources
8.6 from WebStack.Resources.ResourceMap import MapResource
8.7 + from WebStack.Resources.Selectors import EncodingSelector
8.8 from WebStack.Resources.Static import DirectoryResource
8.9
8.10 + # Configuration setting.
8.11 +
8.12 + encoding = "utf-8"
8.13 +
8.14 class Configurator(ConfiguratorResource, XSLForms.Resources.PyQtWebResources.XSLFormsResource):
8.15 def __init__(self, *args, **kw):
8.16 XSLForms.Resources.PyQtWebResources.XSLFormsResource.__init__(self, "configuration")
8.17 @@ -220,11 +225,12 @@
8.18
8.19 configurator_resource = Configurator(*args, **kw)
8.20 directory = configurator_resource.resource_dir
8.21 - resource = MapResource({
8.22 + root_resource = MapResource({
8.23 "styles" : DirectoryResource(os.path.join(directory, "styles"), {"css" : "text/css"}),
8.24 "scripts" : DirectoryResource(os.path.join(directory, "scripts"), {"js" : "text/javascript"}),
8.25 "" : configurator_resource
8.26 })
8.27 + resource = EncodingSelector(root_resource, encoding)
8.28
8.29 # Do not initialise or populate the resource here: both happen when a
8.30 # Web request is received (initialisation when no form document is
9.1 --- a/examples/Common/Questionnaire/__init__.py Sun Jan 21 00:22:40 2007 +0000
9.2 +++ b/examples/Common/Questionnaire/__init__.py Sun Jan 21 00:23:27 2007 +0000
9.3 @@ -10,8 +10,13 @@
9.4 # Site map imports.
9.5
9.6 from WebStack.Resources.ResourceMap import MapResource
9.7 +from WebStack.Resources.Selectors import EncodingSelector
9.8 from WebStack.Resources.Static import DirectoryResource
9.9
9.10 +# Configuration settings.
9.11 +
9.12 +encoding = "utf-8"
9.13 +
9.14 # Resource classes.
9.15
9.16 class QuestionnaireEditorResource(XSLForms.Resources.WebResources.XSLFormsResource):
9.17 @@ -19,7 +24,6 @@
9.18 "A resource providing a questionnaire editor."
9.19
9.20 resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")
9.21 - encoding = "utf-8"
9.22 template_resources = {
9.23 "question" : ("question_template.xhtml", "question_output.xsl")
9.24 }
9.25 @@ -58,7 +62,7 @@
9.26 # When exported, an XML version of the data is returned.
9.27
9.28 if parameters.has_key("export"):
9.29 - trans.set_content_type(WebStack.Generic.ContentType("text/xml", self.encoding))
9.30 + trans.set_content_type(WebStack.Generic.ContentType("text/xml", encoding))
9.31 questionnaire.toStream(trans.get_response_stream(), trans.get_response_stream_encoding())
9.32
9.33 # When not exported, the data is transformed to produce a normal Web
9.34 @@ -68,7 +72,7 @@
9.35
9.36 # Start the response.
9.37
9.38 - trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", self.encoding))
9.39 + trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", encoding))
9.40
9.41 # Ensure that an output stylesheet exists.
9.42
9.43 @@ -98,7 +102,7 @@
9.44 "" : questionnaire_resource
9.45 })
9.46
9.47 - return resource
9.48 + return EncodingSelector(resource, encoding)
9.49
9.50 # Resource preparation ahead of time - useful for making installations.
9.51
10.1 --- a/examples/Common/Recursive/__init__.py Sun Jan 21 00:22:40 2007 +0000
10.2 +++ b/examples/Common/Recursive/__init__.py Sun Jan 21 00:23:27 2007 +0000
10.3 @@ -7,6 +7,14 @@
10.4 import XSLForms.Utils
10.5 import os
10.6
10.7 +# Site map imports.
10.8 +
10.9 +from WebStack.Resources.Selectors import EncodingSelector
10.10 +
10.11 +# Configuration settings.
10.12 +
10.13 +encoding = "utf-8"
10.14 +
10.15 # Resource classes.
10.16
10.17 class RecursiveResource(XSLForms.Resources.WebResources.XSLFormsResource):
10.18 @@ -14,7 +22,6 @@
10.19 "A resource providing a recursive hierarchy of editable fields."
10.20
10.21 resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")
10.22 - encoding = "utf-8"
10.23 template_resources = {
10.24 "recursive" : ("recursive_template.xhtml", "recursive_output.xsl")
10.25 }
10.26 @@ -54,7 +61,7 @@
10.27
10.28 # Start the response.
10.29
10.30 - trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", self.encoding))
10.31 + trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", encoding))
10.32
10.33 # Ensure that an output stylesheet exists.
10.34
10.35 @@ -73,7 +80,8 @@
10.36
10.37 # Get the main resource and the directory used by the application.
10.38
10.39 - return RecursiveResource()
10.40 + resource = RecursiveResource()
10.41 + return EncodingSelector(resource, encoding)
10.42
10.43 # Resource preparation ahead of time - useful for making installations.
10.44
11.1 --- a/examples/Common/VerySimple/__init__.py Sun Jan 21 00:22:40 2007 +0000
11.2 +++ b/examples/Common/VerySimple/__init__.py Sun Jan 21 00:23:27 2007 +0000
11.3 @@ -10,8 +10,13 @@
11.4 # Site map imports.
11.5
11.6 from WebStack.Resources.ResourceMap import MapResource
11.7 +from WebStack.Resources.Selectors import EncodingSelector
11.8 from WebStack.Resources.Static import DirectoryResource
11.9
11.10 +# Configuration settings.
11.11 +
11.12 +encoding = "utf-8"
11.13 +
11.14 # Resource classes.
11.15
11.16 class VerySimpleResource(XSLForms.Resources.WebResources.XSLFormsResource):
11.17 @@ -19,7 +24,6 @@
11.18 "A very simple resource providing a hierarchy of editable fields."
11.19
11.20 resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")
11.21 - encoding = "utf-8"
11.22 template_resources = {
11.23 #"structure" : ("structure_template.xhtml", "structure_output.xsl")
11.24 #"structure" : ("structure_multivalue_template.xhtml", "structure_output.xsl")
11.25 @@ -81,7 +85,7 @@
11.26
11.27 # Start the response.
11.28
11.29 - trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", self.encoding))
11.30 + trans.set_content_type(WebStack.Generic.ContentType("application/xhtml+xml", encoding))
11.31
11.32 # Ensure that an output stylesheet exists.
11.33
11.34 @@ -121,7 +125,7 @@
11.35 None : very_simple_resource
11.36 })
11.37
11.38 - return resource
11.39 + return EncodingSelector(resource, encoding)
11.40
11.41 # Resource preparation ahead of time - useful for making installations.
11.42