1.1 --- a/WebStack/BaseHTTPRequestHandler.py Sat Jan 20 23:16:25 2007 +0000
1.2 +++ b/WebStack/BaseHTTPRequestHandler.py Sun Jan 21 00:32:06 2007 +0000
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 BaseHTTPRequestHandler classes.
1.6
1.7 -Copyright (C) 2004, 2005, 2006 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2004, 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 @@ -282,6 +282,8 @@
1.13
1.14 # NOTE: Support at best ISO-8859-1 values.
1.15
1.16 + encoding = encoding or self.default_charset
1.17 +
1.18 fields = {}
1.19 for name, values in parse_qs(self.get_query_string(), keep_blank_values=1).items():
1.20 name = decode_value(name, encoding)
2.1 --- a/WebStack/CGI.py Sat Jan 20 23:16:25 2007 +0000
2.2 +++ b/WebStack/CGI.py Sun Jan 21 00:32:06 2007 +0000
2.3 @@ -3,7 +3,7 @@
2.4 """
2.5 CGI classes.
2.6
2.7 -Copyright (C) 2004, 2005, 2006 Paul Boddie <paul@boddie.org.uk>
2.8 +Copyright (C) 2004, 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 @@ -220,6 +220,8 @@
2.13 character values.
2.14 """
2.15
2.16 + encoding = encoding or self.default_charset
2.17 +
2.18 path = decode_value(self.env.get("SCRIPT_NAME") or "", encoding)
2.19 path += self.get_path_info(encoding)
2.20 return path
2.21 @@ -237,6 +239,8 @@
2.22 character values.
2.23 """
2.24
2.25 + encoding = encoding or self.default_charset
2.26 +
2.27 return decode_value(self.env.get("PATH_INFO") or "", encoding)
2.28
2.29 def get_query_string(self):
2.30 @@ -262,6 +266,8 @@
2.31 single value is associated with any given field name).
2.32 """
2.33
2.34 + encoding = encoding or self.default_charset
2.35 +
2.36 fields = {}
2.37 for name, values in parse_qs(self.get_query_string(), keep_blank_values=1).items():
2.38 name = decode_value(name, encoding)
3.1 --- a/WebStack/Django.py Sat Jan 20 23:16:25 2007 +0000
3.2 +++ b/WebStack/Django.py Sun Jan 21 00:32:06 2007 +0000
3.3 @@ -3,7 +3,7 @@
3.4 """
3.5 Django classes.
3.6
3.7 -Copyright (C) 2006 Paul Boddie <paul@boddie.org.uk>
3.8 +Copyright (C) 2006, 2007 Paul Boddie <paul@boddie.org.uk>
3.9
3.10 This library is free software; you can redistribute it and/or
3.11 modify it under the terms of the GNU Lesser General Public
3.12 @@ -167,6 +167,8 @@
3.13 character values.
3.14 """
3.15
3.16 + encoding = encoding or self.default_charset
3.17 +
3.18 return decode_value(self.request.get_full_path(), encoding)
3.19
3.20 def get_path_without_query(self, encoding=None):
3.21 @@ -197,6 +199,8 @@
3.22 character values.
3.23 """
3.24
3.25 + encoding = encoding or self.default_charset
3.26 +
3.27 path_info = self.request.META.get("PATH_INFO") or ""
3.28 return decode_value(path_info, encoding)
3.29
3.30 @@ -246,6 +250,9 @@
3.31 return fields
3.32
3.33 def _get_fields(self, source, encoding=None):
3.34 +
3.35 + encoding = encoding or self.get_content_type().charset or self.default_charset
3.36 +
3.37 fields = {}
3.38 for name in source.keys():
3.39 name = decode_value(name, encoding)
4.1 --- a/WebStack/ModPython.py Sat Jan 20 23:16:25 2007 +0000
4.2 +++ b/WebStack/ModPython.py Sun Jan 21 00:32:06 2007 +0000
4.3 @@ -183,6 +183,8 @@
4.4 character values.
4.5 """
4.6
4.7 + encoding = encoding or self.default_charset
4.8 +
4.9 query_string = self.get_query_string()
4.10 if query_string:
4.11 return decode_value(self.trans.uri, encoding) + "?" + query_string
4.12 @@ -201,6 +203,8 @@
4.13 character values.
4.14 """
4.15
4.16 + encoding = encoding or self.default_charset
4.17 +
4.18 return decode_value(self.trans.uri, encoding)
4.19
4.20 def get_path_info(self, encoding=None):
4.21 @@ -216,6 +220,8 @@
4.22 character values.
4.23 """
4.24
4.25 + encoding = encoding or self.default_charset
4.26 +
4.27 return decode_value(self.trans.path_info, encoding)
4.28
4.29 def get_query_string(self):
4.30 @@ -241,6 +247,8 @@
4.31 single value is associated with any given field name).
4.32 """
4.33
4.34 + encoding = encoding or self.default_charset
4.35 +
4.36 fields = {}
4.37 for name, values in parse_qs(self.get_query_string(), 1).items(): # keep_blank_values=1
4.38 name = decode_value(name, encoding)
5.1 --- a/WebStack/Twisted.py Sat Jan 20 23:16:25 2007 +0000
5.2 +++ b/WebStack/Twisted.py Sun Jan 21 00:32:06 2007 +0000
5.3 @@ -3,7 +3,7 @@
5.4 """
5.5 Twisted classes.
5.6
5.7 -Copyright (C) 2004, 2005, 2006 Paul Boddie <paul@boddie.org.uk>
5.8 +Copyright (C) 2004, 2005, 2006, 2007 Paul Boddie <paul@boddie.org.uk>
5.9
5.10 This library is free software; you can redistribute it and/or
5.11 modify it under the terms of the GNU Lesser General Public
5.12 @@ -185,6 +185,8 @@
5.13 character values.
5.14 """
5.15
5.16 + encoding = encoding or self.default_charset
5.17 +
5.18 return decode_value("/%s" % "/".join(self.trans.postpath), encoding)
5.19
5.20 def get_query_string(self):
5.21 @@ -217,6 +219,8 @@
5.22 single value is associated with any given field name).
5.23 """
5.24
5.25 + encoding = encoding or self.default_charset
5.26 +
5.27 fields = {}
5.28 for name, values in parse_qs(self.get_query_string(), keep_blank_values=1).items():
5.29 name = decode_value(name, encoding)
6.1 --- a/WebStack/WSGI.py Sat Jan 20 23:16:25 2007 +0000
6.2 +++ b/WebStack/WSGI.py Sun Jan 21 00:32:06 2007 +0000
6.3 @@ -3,7 +3,7 @@
6.4 """
6.5 WSGI classes.
6.6
6.7 -Copyright (C) 2004, 2005, 2006 Paul Boddie <paul@boddie.org.uk>
6.8 +Copyright (C) 2004, 2005, 2006, 2007 Paul Boddie <paul@boddie.org.uk>
6.9
6.10 This library is free software; you can redistribute it and/or
6.11 modify it under the terms of the GNU Lesser General Public
6.12 @@ -222,6 +222,8 @@
6.13 character values.
6.14 """
6.15
6.16 + encoding = encoding or self.default_charset
6.17 +
6.18 path = decode_value(self.env.get("SCRIPT_NAME") or "", encoding)
6.19 path += self.get_path_info(encoding)
6.20 return path
6.21 @@ -239,6 +241,8 @@
6.22 character values.
6.23 """
6.24
6.25 + encoding = encoding or self.default_charset
6.26 +
6.27 return decode_value(self.env.get("PATH_INFO") or "", encoding)
6.28
6.29 def get_query_string(self):
6.30 @@ -264,6 +268,8 @@
6.31 single value is associated with any given field name).
6.32 """
6.33
6.34 + encoding = encoding or self.default_charset
6.35 +
6.36 fields = {}
6.37 for name, values in parse_qs(self.get_query_string(), keep_blank_values=1).items():
6.38 name = decode_value(name, encoding)
7.1 --- a/WebStack/Webware.py Sat Jan 20 23:16:25 2007 +0000
7.2 +++ b/WebStack/Webware.py Sun Jan 21 00:32:06 2007 +0000
7.3 @@ -3,7 +3,7 @@
7.4 """
7.5 Webware classes.
7.6
7.7 -Copyright (C) 2004, 2005, 2006 Paul Boddie <paul@boddie.org.uk>
7.8 +Copyright (C) 2004, 2005, 2006, 2007 Paul Boddie <paul@boddie.org.uk>
7.9
7.10 This library is free software; you can redistribute it and/or
7.11 modify it under the terms of the GNU Lesser General Public
7.12 @@ -195,6 +195,8 @@
7.13 character values.
7.14 """
7.15
7.16 + encoding = encoding or self.default_charset
7.17 +
7.18 path_info = self.trans.request().pathInfo()
7.19 context_name = self.trans.request().contextName()
7.20 if path_info.startswith(context_name):
7.21 @@ -226,6 +228,8 @@
7.22 single value is associated with any given field name).
7.23 """
7.24
7.25 + encoding = encoding or self.default_charset
7.26 +
7.27 fields = {}
7.28 for name, values in parse_qs(self.get_query_string(), keep_blank_values=1).items():
7.29 name = decode_value(name, encoding)
8.1 --- a/WebStack/Zope.py Sat Jan 20 23:16:25 2007 +0000
8.2 +++ b/WebStack/Zope.py Sun Jan 21 00:32:06 2007 +0000
8.3 @@ -3,7 +3,7 @@
8.4 """
8.5 Zope classes.
8.6
8.7 -Copyright (C) 2004, 2005, 2006 Paul Boddie <paul@boddie.org.uk>
8.8 +Copyright (C) 2004, 2005, 2006, 2007 Paul Boddie <paul@boddie.org.uk>
8.9
8.10 This library is free software; you can redistribute it and/or
8.11 modify it under the terms of the GNU Lesser General Public
8.12 @@ -180,6 +180,8 @@
8.13
8.14 # NOTE: Based on WebStack.CGI.get_path.
8.15
8.16 + encoding = encoding or self.default_charset
8.17 +
8.18 path = decode_value(self.request.environ.get("SCRIPT_NAME") or "", encoding)
8.19 path += self.get_path_info(encoding)
8.20 return path
8.21 @@ -197,6 +199,8 @@
8.22 character values.
8.23 """
8.24
8.25 + encoding = encoding or self.default_charset
8.26 +
8.27 product_path = "/".join(self.adapter.getPhysicalPath())
8.28 path_info = self.request.environ.get("PATH_INFO") or ""
8.29 real_path_info = path_info[len(product_path):]
8.30 @@ -225,6 +229,8 @@
8.31 single value is associated with any given field name).
8.32 """
8.33
8.34 + encoding = encoding or self.default_charset
8.35 +
8.36 fields = {}
8.37 for name, values in cgi.parse_qs(self.get_query_string()).items():
8.38 name = decode_value(name, encoding)