1.1 --- a/WebStack/BaseHTTPRequestHandler.py Sat Jan 29 23:34:57 2005 +0000
1.2 +++ b/WebStack/BaseHTTPRequestHandler.py Sat Feb 19 14:01:32 2005 +0000
1.3 @@ -36,6 +36,7 @@
1.4 self.headers_out = {}
1.5 self.cookies_out = SimpleCookie()
1.6 self.user = None
1.7 + self.path_info = None
1.8
1.9 # Define the incoming cookies.
1.10
1.11 @@ -178,7 +179,10 @@
1.12 handling the current request) from the request.
1.13 """
1.14
1.15 - return self.get_path_without_query()
1.16 + if self.path_info is not None:
1.17 + return self.path_info
1.18 + else:
1.19 + return self.get_path_without_query()
1.20
1.21 def get_query_string(self):
1.22
1.23 @@ -471,16 +475,4 @@
1.24 self.session_store = SessionStore(self, "WebStack-sessions")
1.25 self.session_store.expire_session()
1.26
1.27 - # Application-specific methods.
1.28 -
1.29 - def set_user(self, username):
1.30 -
1.31 - """
1.32 - An application-specific method which sets the user information with
1.33 - 'username' in the transaction. This affects subsequent calls to
1.34 - 'get_user'.
1.35 - """
1.36 -
1.37 - self.user = username
1.38 -
1.39 # vim: tabstop=4 expandtab shiftwidth=4
2.1 --- a/WebStack/CGI.py Sat Jan 29 23:34:57 2005 +0000
2.2 +++ b/WebStack/CGI.py Sat Feb 19 14:01:32 2005 +0000
2.3 @@ -41,6 +41,7 @@
2.4 self.headers_out = {}
2.5 self.cookies_out = SimpleCookie()
2.6 self.user = None
2.7 + self.path_info = None
2.8
2.9 # Define the incoming cookies.
2.10
2.11 @@ -177,7 +178,10 @@
2.12 handling the current request) from the request.
2.13 """
2.14
2.15 - return self.env.get("PATH_INFO") or ""
2.16 + if self.path_info is not None:
2.17 + return self.path_info
2.18 + else:
2.19 + return self.env.get("PATH_INFO") or ""
2.20
2.21 def get_query_string(self):
2.22
2.23 @@ -461,16 +465,4 @@
2.24 self.session_store = SessionStore(self, "WebStack-sessions")
2.25 self.session_store.expire_session()
2.26
2.27 - # Application-specific methods.
2.28 -
2.29 - def set_user(self, username):
2.30 -
2.31 - """
2.32 - An application-specific method which sets the user information with
2.33 - 'username' in the transaction. This affects subsequent calls to
2.34 - 'get_user'.
2.35 - """
2.36 -
2.37 - self.user = username
2.38 -
2.39 # vim: tabstop=4 expandtab shiftwidth=4
3.1 --- a/WebStack/Generic.py Sat Jan 29 23:34:57 2005 +0000
3.2 +++ b/WebStack/Generic.py Sat Feb 19 14:01:32 2005 +0000
3.3 @@ -529,7 +529,16 @@
3.4 'get_user'.
3.5 """
3.6
3.7 - raise NotImplementedError, "set_user"
3.8 + self.user = username
3.9 +
3.10 + def set_path_info(self, path_info):
3.11 +
3.12 + """
3.13 + An application-specific method which sets the 'path_info' in the
3.14 + transaction. This affects subsequent calls to 'get_path_info'.
3.15 + """
3.16 +
3.17 + self.path_info = path_info
3.18
3.19 class Resource:
3.20
4.1 --- a/WebStack/JavaServlet.py Sat Jan 29 23:34:57 2005 +0000
4.2 +++ b/WebStack/JavaServlet.py Sat Feb 19 14:01:32 2005 +0000
4.3 @@ -68,6 +68,7 @@
4.4 self.response = response
4.5 self.status = None
4.6 self.user = None
4.7 + self.path_info = None
4.8
4.9 # Remember the cookies received in the request.
4.10 # NOTE: Discarding much of the information received.
4.11 @@ -210,7 +211,10 @@
4.12 handling the current request) from the request.
4.13 """
4.14
4.15 - return self.request.getPathInfo() or ""
4.16 + if self.path_info is not None:
4.17 + return self.path_info
4.18 + else:
4.19 + return self.request.getPathInfo() or ""
4.20
4.21 def get_query_string(self):
4.22
4.23 @@ -487,18 +491,6 @@
4.24 if session:
4.25 session.invalidate()
4.26
4.27 - # Application-specific methods.
4.28 -
4.29 - def set_user(self, username):
4.30 -
4.31 - """
4.32 - An application-specific method which sets the user information with
4.33 - 'username' in the transaction. This affects subsequent calls to
4.34 - 'get_user'.
4.35 - """
4.36 -
4.37 - self.user = username
4.38 -
4.39 # Special Java-specific methods.
4.40
4.41 def _get_fields_from_message(self):
5.1 --- a/WebStack/ModPython.py Sat Jan 29 23:34:57 2005 +0000
5.2 +++ b/WebStack/ModPython.py Sat Feb 19 14:01:32 2005 +0000
5.3 @@ -38,8 +38,9 @@
5.4
5.5 self.trans = trans
5.6 self.response_code = apache.OK
5.7 + self.content_type = None
5.8 self.user = None
5.9 - self.content_type = None
5.10 + self.path_info = None
5.11
5.12 # Support non-framework cookies.
5.13
5.14 @@ -161,7 +162,10 @@
5.15 handling the current request) from the request.
5.16 """
5.17
5.18 - return self.trans.path_info
5.19 + if self.path_info is not None:
5.20 + return self.path_info
5.21 + else:
5.22 + return self.trans.path_info
5.23
5.24 def get_query_string(self):
5.25
5.26 @@ -476,16 +480,4 @@
5.27 self.session_store = SessionStore(self, os.path.join(apache.server_root(), "WebStack-sessions"))
5.28 self.session_store.expire_session()
5.29
5.30 - # Application-specific methods.
5.31 -
5.32 - def set_user(self, username):
5.33 -
5.34 - """
5.35 - An application-specific method which sets the user information with
5.36 - 'username' in the transaction. This affects subsequent calls to
5.37 - 'get_user'.
5.38 - """
5.39 -
5.40 - self.user = username
5.41 -
5.42 # vim: tabstop=4 expandtab shiftwidth=4
6.1 --- a/WebStack/Twisted.py Sat Jan 29 23:34:57 2005 +0000
6.2 +++ b/WebStack/Twisted.py Sat Feb 19 14:01:32 2005 +0000
6.3 @@ -22,8 +22,9 @@
6.4 "Initialise the transaction using the Twisted transaction 'trans'."
6.5
6.6 self.trans = trans
6.7 + self.content_type = None
6.8 self.user = None
6.9 - self.content_type = None
6.10 + self.path_info = None
6.11
6.12 # Special objects retained throughout the transaction.
6.13
6.14 @@ -132,7 +133,10 @@
6.15 handling the current request) from the request.
6.16 """
6.17
6.18 - return "/%s" % "/".join(self.trans.postpath)
6.19 + if self.path_info is not None:
6.20 + return self.path_info
6.21 + else:
6.22 + return "/%s" % "/".join(self.trans.postpath)
6.23
6.24 def get_query_string(self):
6.25
6.26 @@ -420,16 +424,4 @@
6.27 self.session_store = SessionStore(self, "WebStack-sessions")
6.28 self.session_store.expire_session()
6.29
6.30 - # Application-specific methods.
6.31 -
6.32 - def set_user(self, username):
6.33 -
6.34 - """
6.35 - An application-specific method which sets the user information with
6.36 - 'username' in the transaction. This affects subsequent calls to
6.37 - 'get_user'.
6.38 - """
6.39 -
6.40 - self.user = username
6.41 -
6.42 # vim: tabstop=4 expandtab shiftwidth=4
7.1 --- a/WebStack/WSGI.py Sat Jan 29 23:34:57 2005 +0000
7.2 +++ b/WebStack/WSGI.py Sat Feb 19 14:01:32 2005 +0000
7.3 @@ -37,6 +37,7 @@
7.4 self.headers_out = {}
7.5 self.cookies_out = SimpleCookie()
7.6 self.user = None
7.7 + self.path_info = None
7.8
7.9 # Define the incoming cookies.
7.10
7.11 @@ -180,7 +181,10 @@
7.12 handling the current request) from the request.
7.13 """
7.14
7.15 - return self.env.get("PATH_INFO") or ""
7.16 + if self.path_info is not None:
7.17 + return self.path_info
7.18 + else:
7.19 + return self.env.get("PATH_INFO") or ""
7.20
7.21 def get_query_string(self):
7.22
7.23 @@ -464,16 +468,4 @@
7.24 self.session_store = SessionStore(self, "WebStack-sessions")
7.25 self.session_store.expire_session()
7.26
7.27 - # Application-specific methods.
7.28 -
7.29 - def set_user(self, username):
7.30 -
7.31 - """
7.32 - An application-specific method which sets the user information with
7.33 - 'username' in the transaction. This affects subsequent calls to
7.34 - 'get_user'.
7.35 - """
7.36 -
7.37 - self.user = username
7.38 -
7.39 # vim: tabstop=4 expandtab shiftwidth=4
8.1 --- a/WebStack/Webware.py Sat Jan 29 23:34:57 2005 +0000
8.2 +++ b/WebStack/Webware.py Sat Feb 19 14:01:32 2005 +0000
8.3 @@ -22,8 +22,9 @@
8.4 "Initialise the transaction using the Webware transaction 'trans'."
8.5
8.6 self.trans = trans
8.7 + self.content_type = None
8.8 self.user = None
8.9 - self.content_type = None
8.10 + self.path_info = None
8.11
8.12 # Request-related methods.
8.13
8.14 @@ -138,12 +139,15 @@
8.15 handling the current request) from the request.
8.16 """
8.17
8.18 - path_info = self.trans.request().pathInfo()
8.19 - context_name = self.trans.request().contextName()
8.20 - if path_info.startswith(context_name):
8.21 - return path_info[len(context_name):]
8.22 + if self.path_info is not None:
8.23 + return self.path_info
8.24 else:
8.25 - return path_info
8.26 + path_info = self.trans.request().pathInfo()
8.27 + context_name = self.trans.request().contextName()
8.28 + if path_info.startswith(context_name):
8.29 + return path_info[len(context_name):]
8.30 + else:
8.31 + return path_info
8.32
8.33 def get_query_string(self):
8.34
8.35 @@ -406,18 +410,6 @@
8.36
8.37 self.trans.request().setSessionExpired(1)
8.38
8.39 - # Application-specific methods.
8.40 -
8.41 - def set_user(self, username):
8.42 -
8.43 - """
8.44 - An application-specific method which sets the user information with
8.45 - 'username' in the transaction. This affects subsequent calls to
8.46 - 'get_user'.
8.47 - """
8.48 -
8.49 - self.user = username
8.50 -
8.51 class Session:
8.52
8.53 "A more dictionary-like session object than the one Webware provides."
9.1 --- a/WebStack/Zope.py Sat Jan 29 23:34:57 2005 +0000
9.2 +++ b/WebStack/Zope.py Sat Feb 19 14:01:32 2005 +0000
9.3 @@ -38,6 +38,7 @@
9.4
9.5 self.content_type = None
9.6 self.user = None
9.7 + self.path_info = None
9.8
9.9 # Request-related methods.
9.10
9.11 @@ -142,9 +143,12 @@
9.12 handling the current request) from the request.
9.13 """
9.14
9.15 - product_path = "/".join(self.adapter.getPhysicalPath())
9.16 - path_info = self.request.environ.get("PATH_INFO") or ""
9.17 - return path_info[len(product_path):]
9.18 + if self.path_info is not None:
9.19 + return self.path_info
9.20 + else:
9.21 + product_path = "/".join(self.adapter.getPhysicalPath())
9.22 + path_info = self.request.environ.get("PATH_INFO") or ""
9.23 + return path_info[len(product_path):]
9.24
9.25 def get_query_string(self):
9.26
9.27 @@ -408,16 +412,4 @@
9.28
9.29 self.request.SESSION.invalidate()
9.30
9.31 - # Application-specific methods.
9.32 -
9.33 - def set_user(self, username):
9.34 -
9.35 - """
9.36 - An application-specific method which sets the user information with
9.37 - 'username' in the transaction. This affects subsequent calls to
9.38 - 'get_user'.
9.39 - """
9.40 -
9.41 - self.user = username
9.42 -
9.43 # vim: tabstop=4 expandtab shiftwidth=4