# HG changeset patch
# User paulb
# Date 1124987723 0
# Node ID 02caba8116adc3a6fe947afce60726187b590b5d
# Parent 0c148b771c67677b53750834acaaaf8fcc7e9d75
[project @ 2005-08-25 16:35:17 by paulb]
Added missing encoding parameters.
diff -r 0c148b771c67 -r 02caba8116ad WebStack/Resources/ResourceMap.py
--- a/WebStack/Resources/ResourceMap.py Thu Aug 25 13:44:38 2005 +0000
+++ b/WebStack/Resources/ResourceMap.py Thu Aug 25 16:35:23 2005 +0000
@@ -150,7 +150,7 @@
trans.set_response_code(404)
trans.set_content_type(WebStack.Generic.ContentType("text/plain"))
out = trans.get_response_stream()
- out.write("Resource '%s' not found." % trans.get_path_info())
+ out.write("Resource '%s' not found." % trans.get_path_info(self.urlencoding))
def send_redirect(self, trans):
@@ -159,12 +159,13 @@
end of the request path.
"""
+ path_without_query = trans.get_path_without_query(self.urlencoding)
query_string = trans.get_query_string()
if query_string:
query_string = "?" + query_string
trans.set_response_code(302)
- trans.set_header_value("Location", trans.get_path_without_query() + "/" + query_string)
+ trans.set_header_value("Location", trans.encode_path(path_without_query, self.urlencoding) + "/" + query_string)
raise WebStack.Generic.EndOfResponse
# vim: tabstop=4 expandtab shiftwidth=4
diff -r 0c148b771c67 -r 02caba8116ad examples/Common/Calendar/__init__.py
--- a/examples/Common/Calendar/__init__.py Thu Aug 25 13:44:38 2005 +0000
+++ b/examples/Common/Calendar/__init__.py Thu Aug 25 16:35:23 2005 +0000
@@ -85,7 +85,7 @@
HTTP/1.1 200 OK
-""" % (trans.get_path_without_query(), time_now, trans.get_path_without_query()))
+""" % (trans.get_path_without_query(self.urlencoding), time_now, trans.get_path_without_query(self.urlencoding)))
for filename in os.listdir(self.resource_dir):
pathname = os.path.join(self.resource_dir, filename)
@@ -105,7 +105,7 @@
HTTP/1.1 200 OK
-""" % (trans.get_path_without_query(), filename, created, filename, "text/calendar", size))
+""" % (trans.get_path_without_query(self.urlencoding), filename, created, filename, "text/calendar", size))
out.write("""
diff -r 0c148b771c67 -r 02caba8116ad examples/Common/Cookies/__init__.py
--- a/examples/Common/Cookies/__init__.py Thu Aug 25 13:44:38 2005 +0000
+++ b/examples/Common/Cookies/__init__.py Thu Aug 25 16:35:23 2005 +0000
@@ -9,13 +9,15 @@
"A resource adding and removing cookies."
+ urlencoding = "utf-8"
+
def respond(self, trans):
trans.set_content_type(WebStack.Generic.ContentType("text/html"))
# Get the fields and choose an action.
fields_from_path = trans.get_fields_from_path()
- path = trans.get_path_without_query()
+ path = trans.get_path_without_query(self.urlencoding)
# If the "set method" form was used, set the new method.