1.1 --- a/XSLForms/Resources/WebResources.py Sun Jan 21 00:22:40 2007 +0000
1.2 +++ b/XSLForms/Resources/WebResources.py Sun Jan 21 00:23:27 2007 +0000
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 Resources for use with WebStack.
1.6
1.7 -Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2005, 2006, 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 @@ -79,8 +79,8 @@
1.13 bodies
1.14 """
1.15
1.16 - path_encoding = "utf-8"
1.17 - encoding = "utf-8"
1.18 + #path_encoding = "utf-8"
1.19 + #encoding = "utf-8"
1.20 template_resources = {}
1.21 in_page_resources = {}
1.22 init_resources = {}
1.23 @@ -236,7 +236,10 @@
1.24 'trans'.
1.25 """
1.26
1.27 - return trans.get_path_info(self.path_encoding).split("/")[-1]
1.28 + if hasattr(self, "path_encoding"):
1.29 + return trans.get_path_info(self.path_encoding).split("/")[-1]
1.30 + else:
1.31 + return trans.get_path_info().split("/")[-1]
1.32
1.33 def respond(self, trans):
1.34
1.35 @@ -255,21 +258,20 @@
1.36 if method == "GET":
1.37
1.38 # Get the fields from the request path (URL).
1.39 - # NOTE: The encoding is actually redundant since WebStack produces
1.40 - # NOTE: Unicode values.
1.41
1.42 - form = XSLForms.Fields.Form(encoding=self.path_encoding, values_are_lists=1)
1.43 + form = XSLForms.Fields.Form(encoding=None, values_are_lists=1)
1.44 parameters = trans.get_fields_from_path()
1.45 form.set_parameters(parameters)
1.46
1.47 elif method == "POST" and content_type.media_type == "application/x-www-form-urlencoded":
1.48
1.49 # Get the fields from the request body.
1.50 - # NOTE: The encoding is actually redundant since WebStack produces
1.51 - # NOTE: Unicode values.
1.52
1.53 - form = XSLForms.Fields.Form(encoding=self.encoding, values_are_lists=1)
1.54 - parameters = trans.get_fields_from_body(self.encoding)
1.55 + form = XSLForms.Fields.Form(encoding=None, values_are_lists=1)
1.56 + if hasattr(self, "encoding"):
1.57 + parameters = trans.get_fields_from_body(self.encoding)
1.58 + else:
1.59 + parameters = trans.get_fields_from_body()
1.60
1.61 # NOTE: Konqueror workaround.
1.62 self.clean_parameters(parameters)
1.63 @@ -280,7 +282,7 @@
1.64
1.65 # Initialise empty container.
1.66
1.67 - form = XSLForms.Fields.Form(encoding=self.encoding, values_are_lists=1)
1.68 + form = XSLForms.Fields.Form(encoding=None, values_are_lists=1)
1.69
1.70 # Call an overridden method with the processed request information.
1.71