1.1 --- a/WebStack/Resources/Login.py Sat Feb 02 23:33:13 2008 +0000
1.2 +++ b/WebStack/Resources/Login.py Sat Feb 02 23:35:36 2008 +0000
1.3 @@ -28,8 +28,6 @@
1.4
1.5 "A resource providing a login screen."
1.6
1.7 - encoding = "utf-8"
1.8 -
1.9 def __init__(self, authenticator, use_redirect=1, urlencoding=None, encoding=None):
1.10
1.11 """
1.12 @@ -53,7 +51,7 @@
1.13 self.authenticator = authenticator
1.14 self.use_redirect = use_redirect
1.15 self.urlencoding = urlencoding
1.16 - self.encoding = encoding or self.encoding
1.17 + self.encoding = encoding
1.18
1.19 def respond(self, trans):
1.20
2.1 --- a/WebStack/Resources/LoginRedirect.py Sat Feb 02 23:33:13 2008 +0000
2.2 +++ b/WebStack/Resources/LoginRedirect.py Sat Feb 02 23:35:36 2008 +0000
2.3 @@ -28,8 +28,6 @@
2.4
2.5 "A resource redirecting to a login URL."
2.6
2.7 - encoding = "utf-8"
2.8 -
2.9 def __init__(self, resource, authenticator, login_url=None, app_url=None,
2.10 anonymous_parameter_name=None, anonymous_username="anonymous",
2.11 logout_parameter_name=None, logout_url="/", use_logout_redirect=1,
2.12 @@ -76,7 +74,7 @@
2.13 self.logout_parameter_name = logout_parameter_name
2.14 self.logout_url = logout_url
2.15 self.use_logout_redirect = use_logout_redirect
2.16 - self.path_encoding = path_encoding or urlencoding or self.encoding
2.17 + self.path_encoding = path_encoding or urlencoding
2.18
2.19 def respond(self, trans):
2.20
2.21 @@ -162,7 +160,7 @@
2.22
2.23 # When logout takes place, show the logout screen.
2.24
2.25 - trans.set_content_type(WebStack.Generic.ContentType("text/html", self.encoding))
2.26 + trans.set_content_type(WebStack.Generic.ContentType("text/html"))
2.27 out = trans.get_response_stream()
2.28 out.write(self.logout_page % redirect)
2.29
3.1 --- a/WebStack/Resources/OpenIDInitiation.py Sat Feb 02 23:33:13 2008 +0000
3.2 +++ b/WebStack/Resources/OpenIDInitiation.py Sat Feb 02 23:35:36 2008 +0000
3.3 @@ -28,7 +28,6 @@
3.4
3.5 "A resource providing an OpenID initiation screen."
3.6
3.7 - encoding = "utf-8"
3.8 openid_ns = "http://specs.openid.net/auth/2.0"
3.9
3.10 def __init__(self, openid_mode=None, use_redirect=1, urlencoding=None, encoding=None):
3.11 @@ -57,7 +56,7 @@
3.12 self.openid_mode = openid_mode or "checkid_setup"
3.13 self.use_redirect = use_redirect
3.14 self.urlencoding = urlencoding
3.15 - self.encoding = encoding or self.encoding
3.16 + self.encoding = encoding
3.17
3.18 def respond(self, trans):
3.19
4.1 --- a/WebStack/Resources/OpenIDLogin.py Sat Feb 02 23:33:13 2008 +0000
4.2 +++ b/WebStack/Resources/OpenIDLogin.py Sat Feb 02 23:35:36 2008 +0000
4.3 @@ -171,8 +171,6 @@
4.4
4.5 "A resource providing a login screen."
4.6
4.7 - encoding = "utf-8"
4.8 -
4.9 def __init__(self, app_url, authenticator, associations=None, use_redirect=1, urlencoding=None, encoding=None):
4.10
4.11 """
4.12 @@ -201,7 +199,7 @@
4.13 self.app_url = app_url
4.14 self.authenticator = authenticator
4.15 self.urlencoding = urlencoding
4.16 - self.encoding = encoding or self.encoding
4.17 + self.encoding = encoding
4.18
4.19 def respond(self, trans):
4.20
5.1 --- a/WebStack/Resources/OpenIDRedirect.py Sat Feb 02 23:33:13 2008 +0000
5.2 +++ b/WebStack/Resources/OpenIDRedirect.py Sat Feb 02 23:35:36 2008 +0000
5.3 @@ -62,7 +62,6 @@
5.4 cookie, accepting OpenID assertions if necessary.
5.5 """
5.6
5.7 - encoding = "utf-8"
5.8 openid_ns = "http://specs.openid.net/auth/2.0"
5.9 replay_limit = datetime.timedelta(0, 10) # 10s
5.10
5.11 @@ -79,7 +78,7 @@
5.12 self.app_url = app_url
5.13 self.associations = associations or {}
5.14 self.replay_limit = replay_limit or self.replay_limit
5.15 - self.urlencoding = urlencoding or self.encoding
5.16 + self.urlencoding = urlencoding
5.17
5.18 def authenticate(self, trans, verify=0):
5.19
6.1 --- a/WebStack/Resources/ResourceMap.py Sat Feb 02 23:33:13 2008 +0000
6.2 +++ b/WebStack/Resources/ResourceMap.py Sat Feb 02 23:35:36 2008 +0000
6.3 @@ -26,8 +26,6 @@
6.4
6.5 "A resource mapping names to other resources."
6.6
6.7 - path_encoding = "utf-8"
6.8 -
6.9 def __init__(self, mapping, pass_through=0, directory_redirects=1, path_encoding=None, urlencoding=None):
6.10
6.11 """
6.12 @@ -86,7 +84,7 @@
6.13 self.mapping = mapping
6.14 self.pass_through = pass_through
6.15 self.directory_redirects = directory_redirects
6.16 - self.path_encoding = path_encoding or urlencoding or self.path_encoding
6.17 + self.path_encoding = path_encoding or urlencoding
6.18
6.19 def respond(self, trans):
6.20
6.21 @@ -170,4 +168,19 @@
6.22 query_string = "?" + query_string
6.23 trans.redirect(trans.encode_path(path_without_query, self.path_encoding) + "/" + query_string)
6.24
6.25 +class SimpleMap(MapResource):
6.26 +
6.27 + "A simple mapping of names to resources, focused on the most common case."
6.28 +
6.29 + def __init__(self, mapping, directory_redirects=1):
6.30 +
6.31 + """
6.32 + Initialise the resource with the given 'mapping' and optional
6.33 + 'directory_redirects' settings. Unlike MapResource, other options are
6.34 + not exposed: if the 'mapping' has an entry for None, the 'pass_through'
6.35 + option of MapResource is enabled.
6.36 + """
6.37 +
6.38 + MapResource.__init__(self, mapping, mapping.has_key(None), directory_redirects)
6.39 +
6.40 # vim: tabstop=4 expandtab shiftwidth=4
7.1 --- a/WebStack/Resources/Selectors.py Sat Feb 02 23:33:13 2008 +0000
7.2 +++ b/WebStack/Resources/Selectors.py Sat Feb 02 23:35:36 2008 +0000
7.3 @@ -25,7 +25,7 @@
7.4
7.5 "Set a request's current path and processed path info on an attribute."
7.6
7.7 - def __init__(self, resource, add_slash=1, attribute_name="root", path_encoding="utf-8"):
7.8 + def __init__(self, resource, add_slash=1, attribute_name="root", path_encoding=None):
7.9
7.10 """
7.11 Initialise the selector with a 'resource' (to which all requests shall
8.1 --- a/WebStack/Resources/Static.py Sat Feb 02 23:33:13 2008 +0000
8.2 +++ b/WebStack/Resources/Static.py Sat Feb 02 23:35:36 2008 +0000
8.3 @@ -30,7 +30,7 @@
8.4 def __init__(self, directory, media_types=None,
8.5 unrecognised_media_type="application/data", content_types=None,
8.6 unrecognised_content_type=None, default_encoding=None,
8.7 - urlencoding="utf-8"):
8.8 + urlencoding=None):
8.9
8.10 """
8.11 Initialise the resource to serve files from the given 'directory'.