1.1 --- a/WebStack/BaseHTTPRequestHandler.py Thu Aug 26 20:37:56 2004 +0000
1.2 +++ b/WebStack/BaseHTTPRequestHandler.py Thu Aug 26 21:07:45 2004 +0000
1.3 @@ -81,8 +81,7 @@
1.4 def get_request_stream(self):
1.5
1.6 """
1.7 - A framework-specific method which returns the request stream for
1.8 - the transaction.
1.9 + Returns the request stream for the transaction.
1.10 """
1.11
1.12 return MessageBodyStream(self.trans.rfile, self.get_headers())
1.13 @@ -90,7 +89,7 @@
1.14 def get_request_method(self):
1.15
1.16 """
1.17 - A framework-specific method which gets the request method.
1.18 + Returns the request method.
1.19 """
1.20
1.21 return self.trans.command
1.22 @@ -98,8 +97,9 @@
1.23 def get_headers(self):
1.24
1.25 """
1.26 - A framework-specific method which returns all request headers as a
1.27 - dictionary-like object mapping header names to values.
1.28 + Returns all request headers as a dictionary-like object mapping header
1.29 + names to values.
1.30 +
1.31 NOTE: If duplicate header names are permitted, then this interface will
1.32 NOTE: need to change.
1.33 """
1.34 @@ -109,9 +109,9 @@
1.35 def get_header_values(self, key):
1.36
1.37 """
1.38 - A framework-specific method which returns a list of all request header
1.39 - values associated with the given 'key'. Note that according to RFC 2616,
1.40 - 'key' is treated as a case-insensitive string.
1.41 + Returns a list of all request header values associated with the given
1.42 + 'key'. Note that according to RFC 2616, 'key' is treated as a
1.43 + case-insensitive string.
1.44 """
1.45
1.46 return self.convert_to_list(self.trans.headers.get(key))
1.47 @@ -119,8 +119,8 @@
1.48 def get_content_type(self):
1.49
1.50 """
1.51 - A framework-specific method which gets the content type specified on the
1.52 - request, along with the charset employed.
1.53 + Returns the content type specified on the request, along with the
1.54 + charset employed.
1.55 """
1.56
1.57 return self.parse_content_type(self.trans.headers.get("content-type"))
1.58 @@ -136,8 +136,7 @@
1.59 def get_content_languages(self):
1.60
1.61 """
1.62 - A framework-specific method which extracts language information from
1.63 - the transaction.
1.64 + Returns extracted language information from the transaction.
1.65 """
1.66
1.67 return self.parse_content_preferences(self.trans.headers.get("accept-language"))
1.68 @@ -145,7 +144,7 @@
1.69 def get_path(self):
1.70
1.71 """
1.72 - A framework-specific method which gets the entire path from the request.
1.73 + Returns the entire path from the request.
1.74 """
1.75
1.76 return self.trans.path
1.77 @@ -153,8 +152,7 @@
1.78 def get_path_without_query(self):
1.79
1.80 """
1.81 - A framework-specific method which gets the entire path from the request
1.82 - minus the query string.
1.83 + Returns the entire path from the request minus the query string.
1.84 """
1.85
1.86 # Remove the query string from the end of the path.
1.87 @@ -164,9 +162,8 @@
1.88 def get_path_info(self):
1.89
1.90 """
1.91 - A framework-specific method which gets the "path info" (the part of the
1.92 - URL after the resource name handling the current request) from the
1.93 - request.
1.94 + Returns the "path info" (the part of the URL after the resource name
1.95 + handling the current request) from the request.
1.96 """
1.97
1.98 return self.get_path_without_query()
1.99 @@ -174,8 +171,7 @@
1.100 def get_query_string(self):
1.101
1.102 """
1.103 - A framework-specific method which gets the query string from the path in
1.104 - the request.
1.105 + Returns the query string from the path in the request.
1.106 """
1.107
1.108 t = self.trans.path.split("?")
1.109 @@ -192,9 +188,9 @@
1.110 def get_fields_from_path(self):
1.111
1.112 """
1.113 - A framework-specific method which extracts the form fields from the
1.114 - path specified in the transaction. The underlying framework may refuse
1.115 - to supply fields from the path if handling a POST transaction.
1.116 + Extracts the form fields from the path specified in the transaction. The
1.117 + underlying framework may refuse to supply fields from the path if
1.118 + handling a POST transaction.
1.119
1.120 Returns a dictionary mapping field names to lists of values (even if a
1.121 single value is associated with any given field name).
1.122 @@ -205,11 +201,10 @@
1.123 def get_fields_from_body(self, encoding=None):
1.124
1.125 """
1.126 - A framework-specific method which extracts the form fields from the
1.127 - message body in the transaction. The optional 'encoding' parameter
1.128 - specifies the character encoding of the message body for cases where no
1.129 - such information is available, but where the default encoding is to be
1.130 - overridden.
1.131 + Extracts the form fields from the message body in the transaction. The
1.132 + optional 'encoding' parameter specifies the character encoding of the
1.133 + message body for cases where no such information is available, but where
1.134 + the default encoding is to be overridden.
1.135
1.136 Returns a dictionary mapping field names to lists of values (even if a
1.137 single value is associated with any given field name).
1.138 @@ -238,8 +233,7 @@
1.139 def get_user(self):
1.140
1.141 """
1.142 - A framework-specific method which extracts user information from the
1.143 - transaction.
1.144 + Extracts user information from the transaction.
1.145
1.146 Returns a username as a string or None if no user is defined.
1.147 """
1.148 @@ -256,8 +250,7 @@
1.149 def get_cookies(self):
1.150
1.151 """
1.152 - A framework-specific method which obtains cookie information from the
1.153 - request.
1.154 + Obtains cookie information from the request.
1.155
1.156 Returns a dictionary mapping cookie names to cookie objects.
1.157 """
1.158 @@ -267,8 +260,7 @@
1.159 def get_cookie(self, cookie_name):
1.160
1.161 """
1.162 - A framework-specific method which obtains cookie information from the
1.163 - request.
1.164 + Obtains cookie information from the request.
1.165
1.166 Returns a cookie object for the given 'cookie_name' or None if no such
1.167 cookie exists.
1.168 @@ -281,8 +273,7 @@
1.169 def get_response_stream(self):
1.170
1.171 """
1.172 - A framework-specific method which returns the response stream for
1.173 - the transaction.
1.174 + Returns the response stream for the transaction.
1.175 """
1.176
1.177 # Return a stream which is later emptied into the real stream.
1.178 @@ -325,8 +316,7 @@
1.179 def set_content_type(self, content_type):
1.180
1.181 """
1.182 - A framework-specific method which sets the 'content_type' for the
1.183 - response.
1.184 + Sets the 'content_type' for the response.
1.185 """
1.186
1.187 # The content type has to be written as a header, before actual content,
1.188 @@ -335,11 +325,12 @@
1.189
1.190 self.content_type = content_type
1.191
1.192 + # Higher level response-related methods.
1.193 +
1.194 def set_cookie(self, cookie):
1.195
1.196 """
1.197 - A framework-specific method which stores the given 'cookie' object in
1.198 - the response.
1.199 + Stores the given 'cookie' object in the response.
1.200 """
1.201
1.202 # NOTE: If multiple cookies of the same name could be specified, this
1.203 @@ -350,8 +341,7 @@
1.204 def set_cookie_value(self, name, value, path=None, expires=None):
1.205
1.206 """
1.207 - A framework-specific method which stores a cookie with the given 'name'
1.208 - and 'value' in the response.
1.209 + Stores a cookie with the given 'name' and 'value' in the response.
1.210
1.211 The optional 'path' is a string which specifies the scope of the cookie,
1.212 and the optional 'expires' parameter is a value compatible with the
1.213 @@ -367,9 +357,8 @@
1.214 def delete_cookie(self, cookie_name):
1.215
1.216 """
1.217 - A framework-specific method which adds to the response a request that
1.218 - the cookie with the given 'cookie_name' be deleted/discarded by the
1.219 - client.
1.220 + Adds to the response a request that the cookie with the given
1.221 + 'cookie_name' be deleted/discarded by the client.
1.222 """
1.223
1.224 # Create a special cookie, given that we do not know whether the browser
2.1 --- a/WebStack/CGI.py Thu Aug 26 20:37:56 2004 +0000
2.2 +++ b/WebStack/CGI.py Thu Aug 26 21:07:45 2004 +0000
2.3 @@ -79,8 +79,7 @@
2.4 def get_request_stream(self):
2.5
2.6 """
2.7 - A framework-specific method which returns the request stream for
2.8 - the transaction.
2.9 + Returns the request stream for the transaction.
2.10 """
2.11
2.12 return self.input
2.13 @@ -88,7 +87,7 @@
2.14 def get_request_method(self):
2.15
2.16 """
2.17 - A framework-specific method which gets the request method.
2.18 + Returns the request method.
2.19 """
2.20
2.21 return self.env.get("REQUEST_METHOD")
2.22 @@ -96,8 +95,8 @@
2.23 def get_headers(self):
2.24
2.25 """
2.26 - A framework-specific method which returns all request headers as a
2.27 - dictionary-like object mapping header names to values.
2.28 + Returns all request headers as a dictionary-like object mapping header
2.29 + names to values.
2.30 """
2.31
2.32 return Environment.get_headers(self.env)
2.33 @@ -105,9 +104,9 @@
2.34 def get_header_values(self, key):
2.35
2.36 """
2.37 - A framework-specific method which returns a list of all request header
2.38 - values associated with the given 'key'. Note that according to RFC 2616,
2.39 - 'key' is treated as a case-insensitive string.
2.40 + Returns a list of all request header values associated with the given
2.41 + 'key'. Note that according to RFC 2616, 'key' is treated as a
2.42 + case-insensitive string.
2.43 """
2.44
2.45 return self.convert_to_list(self.get_headers().get(key))
2.46 @@ -115,8 +114,8 @@
2.47 def get_content_type(self):
2.48
2.49 """
2.50 - A framework-specific method which gets the content type specified on the
2.51 - request, along with the charset employed.
2.52 + Returns the content type specified on the request, along with the
2.53 + charset employed.
2.54 """
2.55
2.56 return self.parse_content_type(self.env.get("CONTENT_TYPE"))
2.57 @@ -132,8 +131,7 @@
2.58 def get_content_languages(self):
2.59
2.60 """
2.61 - A framework-specific method which extracts language information from
2.62 - the transaction.
2.63 + Returns extracted language information from the transaction.
2.64 """
2.65
2.66 return self.parse_content_preferences(None)
2.67 @@ -141,7 +139,7 @@
2.68 def get_path(self):
2.69
2.70 """
2.71 - A framework-specific method which gets the entire path from the request.
2.72 + Returns the entire path from the request.
2.73 """
2.74
2.75 path = self.get_path_without_query()
2.76 @@ -154,8 +152,7 @@
2.77 def get_path_without_query(self):
2.78
2.79 """
2.80 - A framework-specific method which gets the entire path from the request
2.81 - minus the query string.
2.82 + Returns the entire path from the request minus the query string.
2.83 """
2.84
2.85 path = self.env.get("SCRIPT_NAME") or ""
2.86 @@ -166,9 +163,8 @@
2.87 def get_path_info(self):
2.88
2.89 """
2.90 - A framework-specific method which gets the "path info" (the part of the
2.91 - URL after the resource name handling the current request) from the
2.92 - request.
2.93 + Returns the "path info" (the part of the URL after the resource name
2.94 + handling the current request) from the request.
2.95 """
2.96
2.97 return self.env.get("PATH_INFO") or ""
2.98 @@ -176,8 +172,7 @@
2.99 def get_query_string(self):
2.100
2.101 """
2.102 - A framework-specific method which gets the query string from the path in
2.103 - the request.
2.104 + Returns the query string from the path in the request.
2.105 """
2.106
2.107 return self.env.get("QUERY_STRING") or ""
2.108 @@ -187,9 +182,9 @@
2.109 def get_fields_from_path(self):
2.110
2.111 """
2.112 - A framework-specific method which extracts the form fields from the
2.113 - path specified in the transaction. The underlying framework may refuse
2.114 - to supply fields from the path if handling a POST transaction.
2.115 + Extracts the form fields from the path specified in the transaction. The
2.116 + underlying framework may refuse to supply fields from the path if
2.117 + handling a POST transaction.
2.118
2.119 Returns a dictionary mapping field names to lists of values (even if a
2.120 single value is associated with any given field name).
2.121 @@ -200,11 +195,10 @@
2.122 def get_fields_from_body(self, encoding=None):
2.123
2.124 """
2.125 - A framework-specific method which extracts the form fields from the
2.126 - message body in the transaction. The optional 'encoding' parameter
2.127 - specifies the character encoding of the message body for cases where no
2.128 - such information is available, but where the default encoding is to be
2.129 - overridden.
2.130 + Extracts the form fields from the message body in the transaction. The
2.131 + optional 'encoding' parameter specifies the character encoding of the
2.132 + message body for cases where no such information is available, but where
2.133 + the default encoding is to be overridden.
2.134
2.135 Returns a dictionary mapping field names to lists of values (even if a
2.136 single value is associated with any given field name).
2.137 @@ -232,8 +226,7 @@
2.138 def get_user(self):
2.139
2.140 """
2.141 - A framework-specific method which extracts user information from the
2.142 - transaction.
2.143 + Extracts user information from the transaction.
2.144
2.145 Returns a username as a string or None if no user is defined.
2.146 """
2.147 @@ -246,8 +239,7 @@
2.148 def get_cookies(self):
2.149
2.150 """
2.151 - A framework-specific method which obtains cookie information from the
2.152 - request.
2.153 + Obtains cookie information from the request.
2.154
2.155 Returns a dictionary mapping cookie names to cookie objects.
2.156 """
2.157 @@ -257,8 +249,7 @@
2.158 def get_cookie(self, cookie_name):
2.159
2.160 """
2.161 - A framework-specific method which obtains cookie information from the
2.162 - request.
2.163 + Obtains cookie information from the request.
2.164
2.165 Returns a cookie object for the given 'cookie_name' or None if no such
2.166 cookie exists.
2.167 @@ -271,8 +262,7 @@
2.168 def get_response_stream(self):
2.169
2.170 """
2.171 - A framework-specific method which returns the response stream for
2.172 - the transaction.
2.173 + Returns the response stream for the transaction.
2.174 """
2.175
2.176 # Return a stream which is later emptied into the real stream.
2.177 @@ -315,8 +305,7 @@
2.178 def set_content_type(self, content_type):
2.179
2.180 """
2.181 - A framework-specific method which sets the 'content_type' for the
2.182 - response.
2.183 + Sets the 'content_type' for the response.
2.184 """
2.185
2.186 # The content type has to be written as a header, before actual content,
2.187 @@ -330,8 +319,7 @@
2.188 def set_cookie(self, cookie):
2.189
2.190 """
2.191 - A framework-specific method which stores the given 'cookie' object in
2.192 - the response.
2.193 + Stores the given 'cookie' object in the response.
2.194 """
2.195
2.196 # NOTE: If multiple cookies of the same name could be specified, this
2.197 @@ -342,8 +330,7 @@
2.198 def set_cookie_value(self, name, value, path=None, expires=None):
2.199
2.200 """
2.201 - A framework-specific method which stores a cookie with the given 'name'
2.202 - and 'value' in the response.
2.203 + Stores a cookie with the given 'name' and 'value' in the response.
2.204
2.205 The optional 'path' is a string which specifies the scope of the cookie,
2.206 and the optional 'expires' parameter is a value compatible with the
2.207 @@ -359,9 +346,8 @@
2.208 def delete_cookie(self, cookie_name):
2.209
2.210 """
2.211 - A framework-specific method which adds to the response a request that
2.212 - the cookie with the given 'cookie_name' be deleted/discarded by the
2.213 - client.
2.214 + Adds to the response a request that the cookie with the given
2.215 + 'cookie_name' be deleted/discarded by the client.
2.216 """
2.217
2.218 # Create a special cookie, given that we do not know whether the browser
3.1 --- a/WebStack/Generic.py Thu Aug 26 20:37:56 2004 +0000
3.2 +++ b/WebStack/Generic.py Thu Aug 26 21:07:45 2004 +0000
3.3 @@ -128,8 +128,7 @@
3.4 def get_request_stream(self):
3.5
3.6 """
3.7 - A framework-specific method which returns the request stream for
3.8 - the transaction.
3.9 + Returns the request stream for the transaction.
3.10 """
3.11
3.12 raise NotImplementedError, "get_request_stream"
3.13 @@ -137,7 +136,7 @@
3.14 def get_request_method(self):
3.15
3.16 """
3.17 - A framework-specific method which gets the request method.
3.18 + Returns the request method.
3.19 """
3.20
3.21 raise NotImplementedError, "get_request_method"
3.22 @@ -145,8 +144,8 @@
3.23 def get_headers(self):
3.24
3.25 """
3.26 - A framework-specific method which returns all request headers as a
3.27 - dictionary-like object mapping header names to values.
3.28 + Returns all request headers as a dictionary-like object mapping header
3.29 + names to values.
3.30 """
3.31
3.32 raise NotImplementedError, "get_headers"
3.33 @@ -154,9 +153,9 @@
3.34 def get_header_values(self, key):
3.35
3.36 """
3.37 - A framework-specific method which returns a list of all request header
3.38 - values associated with the given 'key'. Note that according to RFC 2616,
3.39 - 'key' is treated as a case-insensitive string.
3.40 + Returns a list of all request header values associated with the given
3.41 + 'key'. Note that according to RFC 2616, 'key' is treated as a
3.42 + case-insensitive string.
3.43 """
3.44
3.45 raise NotImplementedError, "get_header_values"
3.46 @@ -164,8 +163,8 @@
3.47 def get_content_type(self):
3.48
3.49 """
3.50 - A framework-specific method which gets the content type specified on the
3.51 - request, along with the charset employed.
3.52 + Returns the content type specified on the request, along with the
3.53 + charset employed.
3.54 """
3.55
3.56 raise NotImplementedError, "get_content_type"
3.57 @@ -181,8 +180,7 @@
3.58 def get_content_languages(self):
3.59
3.60 """
3.61 - A framework-specific method which extracts language information from
3.62 - the transaction.
3.63 + Returns extracted language information from the transaction.
3.64 """
3.65
3.66 raise NotImplementedError, "get_content_languages"
3.67 @@ -190,7 +188,7 @@
3.68 def get_path(self):
3.69
3.70 """
3.71 - A framework-specific method which gets the entire path from the request.
3.72 + Returns the entire path from the request.
3.73 """
3.74
3.75 raise NotImplementedError, "get_path"
3.76 @@ -198,8 +196,7 @@
3.77 def get_path_without_query(self):
3.78
3.79 """
3.80 - A framework-specific method which gets the entire path from the request
3.81 - minus the query string.
3.82 + Returns the entire path from the request minus the query string.
3.83 """
3.84
3.85 raise NotImplementedError, "get_path_without_query"
3.86 @@ -207,9 +204,8 @@
3.87 def get_path_info(self):
3.88
3.89 """
3.90 - A framework-specific method which gets the "path info" (the part of the
3.91 - URL after the resource name handling the current request) from the
3.92 - request.
3.93 + Returns the "path info" (the part of the URL after the resource name
3.94 + handling the current request) from the request.
3.95 """
3.96
3.97 raise NotImplementedError, "get_path_info"
3.98 @@ -217,8 +213,7 @@
3.99 def get_query_string(self):
3.100
3.101 """
3.102 - A framework-specific method which gets the query string from the path in
3.103 - the request.
3.104 + Returns the query string from the path in the request.
3.105 """
3.106
3.107 raise NotImplementedError, "get_query_string"
3.108 @@ -228,9 +223,9 @@
3.109 def get_fields_from_path(self):
3.110
3.111 """
3.112 - A framework-specific method which extracts the form fields from the
3.113 - path specified in the transaction. The underlying framework may refuse
3.114 - to supply fields from the path if handling a POST transaction.
3.115 + Extracts the form fields from the path specified in the transaction. The
3.116 + underlying framework may refuse to supply fields from the path if
3.117 + handling a POST transaction.
3.118
3.119 Returns a dictionary mapping field names to lists of values (even if a
3.120 single value is associated with any given field name).
3.121 @@ -241,11 +236,10 @@
3.122 def get_fields_from_body(self, encoding=None):
3.123
3.124 """
3.125 - A framework-specific method which extracts the form fields from the
3.126 - message body in the transaction. The optional 'encoding' parameter
3.127 - specifies the character encoding of the message body for cases where no
3.128 - such information is available, but where the default encoding is to be
3.129 - overridden.
3.130 + Extracts the form fields from the message body in the transaction. The
3.131 + optional 'encoding' parameter specifies the character encoding of the
3.132 + message body for cases where no such information is available, but where
3.133 + the default encoding is to be overridden.
3.134
3.135 Returns a dictionary mapping field names to lists of values (even if a
3.136 single value is associated with any given field name).
3.137 @@ -256,8 +250,7 @@
3.138 def get_user(self):
3.139
3.140 """
3.141 - A framework-specific method which extracts user information from the
3.142 - transaction.
3.143 + Extracts user information from the transaction.
3.144
3.145 Returns a username as a string or None if no user is defined.
3.146 """
3.147 @@ -267,8 +260,7 @@
3.148 def get_cookies(self):
3.149
3.150 """
3.151 - A framework-specific method which obtains cookie information from the
3.152 - request.
3.153 + Obtains cookie information from the request.
3.154
3.155 Returns a dictionary mapping cookie names to cookie objects.
3.156 """
3.157 @@ -278,8 +270,7 @@
3.158 def get_cookie(self, cookie_name):
3.159
3.160 """
3.161 - A framework-specific method which obtains cookie information from the
3.162 - request.
3.163 + Obtains cookie information from the request.
3.164
3.165 Returns a cookie object for the given 'cookie_name' or None if no such
3.166 cookie exists.
3.167 @@ -292,8 +283,7 @@
3.168 def get_response_stream(self):
3.169
3.170 """
3.171 - A framework-specific method which returns the response stream for
3.172 - the transaction.
3.173 + Returns the response stream for the transaction.
3.174 """
3.175
3.176 raise NotImplementedError, "get_response_stream"
3.177 @@ -327,8 +317,7 @@
3.178 def set_content_type(self, content_type):
3.179
3.180 """
3.181 - A framework-specific method which sets the 'content_type' for the
3.182 - response.
3.183 + Sets the 'content_type' for the response.
3.184 """
3.185
3.186 raise NotImplementedError, "set_content_type"
3.187 @@ -338,8 +327,7 @@
3.188 def set_cookie(self, cookie):
3.189
3.190 """
3.191 - A framework-specific method which stores the given 'cookie' object in
3.192 - the response.
3.193 + Stores the given 'cookie' object in the response.
3.194 """
3.195
3.196 raise NotImplementedError, "set_cookie"
3.197 @@ -347,8 +335,7 @@
3.198 def set_cookie_value(self, name, value, path=None, expires=None):
3.199
3.200 """
3.201 - A framework-specific method which stores a cookie with the given 'name'
3.202 - and 'value' in the response.
3.203 + Stores a cookie with the given 'name' and 'value' in the response.
3.204
3.205 The optional 'path' is a string which specifies the scope of the cookie,
3.206 and the optional 'expires' parameter is a value compatible with the
3.207 @@ -360,9 +347,8 @@
3.208 def delete_cookie(self, cookie_name):
3.209
3.210 """
3.211 - A framework-specific method which adds to the response a request that
3.212 - the cookie with the given 'cookie_name' be deleted/discarded by the
3.213 - client.
3.214 + Adds to the response a request that the cookie with the given
3.215 + 'cookie_name' be deleted/discarded by the client.
3.216 """
3.217
3.218 raise NotImplementedError, "delete_cookie"
3.219 @@ -372,8 +358,8 @@
3.220 def get_session(self, create=1):
3.221
3.222 """
3.223 - A framework-specific method which returns a session corresponding to
3.224 - an identifier supplied in the transaction.
3.225 + Gets a session corresponding to an identifier supplied in the
3.226 + transaction.
3.227
3.228 If no session has yet been established according to information
3.229 provided in the transaction then the optional 'create' parameter
3.230 @@ -389,8 +375,8 @@
3.231 def expire_session(self):
3.232
3.233 """
3.234 - A framework-specific method which expires any session established
3.235 - according to information provided in the transaction.
3.236 + Expires any session established according to information provided in the
3.237 + transaction.
3.238 """
3.239
3.240 raise NotImplementedError, "expire_session"
4.1 --- a/WebStack/JavaServlet.py Thu Aug 26 20:37:56 2004 +0000
4.2 +++ b/WebStack/JavaServlet.py Thu Aug 26 21:07:45 2004 +0000
4.3 @@ -79,8 +79,7 @@
4.4 def get_request_stream(self):
4.5
4.6 """
4.7 - A framework-specific method which returns the request stream for
4.8 - the transaction.
4.9 + Returns the request stream for the transaction.
4.10 """
4.11
4.12 return Stream(self.request.getReader())
4.13 @@ -88,7 +87,7 @@
4.14 def get_request_method(self):
4.15
4.16 """
4.17 - A framework-specific method which gets the request method.
4.18 + Returns the request method.
4.19 """
4.20
4.21 return self.request.getMethod()
4.22 @@ -96,8 +95,9 @@
4.23 def get_headers(self):
4.24
4.25 """
4.26 - A framework-specific method which returns all request headers as a
4.27 - dictionary-like object mapping header names to values.
4.28 + Returns all request headers as a dictionary-like object mapping header
4.29 + names to values.
4.30 +
4.31 NOTE: If duplicate header names are permitted, then this interface will
4.32 NOTE: need to change.
4.33 """
4.34 @@ -116,9 +116,9 @@
4.35 def get_header_values(self, key):
4.36
4.37 """
4.38 - A framework-specific method which returns a list of all request header
4.39 - values associated with the given 'key'. Note that according to RFC 2616,
4.40 - 'key' is treated as a case-insensitive string.
4.41 + Returns a list of all request header values associated with the given
4.42 + 'key'. Note that according to RFC 2616, 'key' is treated as a
4.43 + case-insensitive string.
4.44 """
4.45
4.46 values = []
4.47 @@ -130,8 +130,8 @@
4.48 def get_content_type(self):
4.49
4.50 """
4.51 - A framework-specific method which gets the content type specified on the
4.52 - request, along with the charset employed.
4.53 + Returns the content type specified on the request, along with the
4.54 + charset employed.
4.55 """
4.56
4.57 content_types = self.get_header_values("Content-Type") or []
4.58 @@ -155,8 +155,7 @@
4.59 def get_content_languages(self):
4.60
4.61 """
4.62 - A framework-specific method which extracts language information from
4.63 - the transaction.
4.64 + Returns extracted language information from the transaction.
4.65 """
4.66
4.67 accept_languages = self.get_header_values("Accept-Language") or []
4.68 @@ -168,7 +167,7 @@
4.69 def get_path(self):
4.70
4.71 """
4.72 - A framework-specific method which gets the entire path from the request.
4.73 + Returns the entire path from the request.
4.74 """
4.75
4.76 # NOTE: To be verified.
4.77 @@ -183,8 +182,7 @@
4.78 def get_path_without_query(self):
4.79
4.80 """
4.81 - A framework-specific method which gets the entire path from the request
4.82 - minus the query string.
4.83 + Returns the entire path from the request minus the query string.
4.84 """
4.85
4.86 return self.request.getServletPath()
4.87 @@ -192,9 +190,8 @@
4.88 def get_path_info(self):
4.89
4.90 """
4.91 - A framework-specific method which gets the "path info" (the part of the
4.92 - URL after the resource name handling the current request) from the
4.93 - request.
4.94 + Returns the "path info" (the part of the URL after the resource name
4.95 + handling the current request) from the request.
4.96 """
4.97
4.98 return self.request.getPathInfo()
4.99 @@ -202,8 +199,7 @@
4.100 def get_query_string(self):
4.101
4.102 """
4.103 - A framework-specific method which gets the query string from the path in
4.104 - the request.
4.105 + Returns the query string from the path in the request.
4.106 """
4.107
4.108 return self.request.getQueryString()
4.109 @@ -213,9 +209,9 @@
4.110 def get_fields_from_path(self):
4.111
4.112 """
4.113 - A framework-specific method which extracts the form fields from the
4.114 - path specified in the transaction. The underlying framework may refuse
4.115 - to supply fields from the path if handling a POST transaction.
4.116 + Extracts the form fields from the path specified in the transaction. The
4.117 + underlying framework may refuse to supply fields from the path if
4.118 + handling a POST transaction.
4.119
4.120 Returns a dictionary mapping field names to lists of values (even if a
4.121 single value is associated with any given field name).
4.122 @@ -229,11 +225,10 @@
4.123 def get_fields_from_body(self, encoding=None):
4.124
4.125 """
4.126 - A framework-specific method which extracts the form fields from the
4.127 - message body in the transaction. The optional 'encoding' parameter
4.128 - specifies the character encoding of the message body for cases where no
4.129 - such information is available, but where the default encoding is to be
4.130 - overridden.
4.131 + Extracts the form fields from the message body in the transaction. The
4.132 + optional 'encoding' parameter specifies the character encoding of the
4.133 + message body for cases where no such information is available, but where
4.134 + the default encoding is to be overridden.
4.135
4.136 Returns a dictionary mapping field names to lists of values (even if a
4.137 single value is associated with any given field name).
4.138 @@ -253,8 +248,7 @@
4.139 def get_user(self):
4.140
4.141 """
4.142 - A framework-specific method which extracts user information from the
4.143 - transaction.
4.144 + Extracts user information from the transaction.
4.145
4.146 Returns a username as a string or None if no user is defined.
4.147 """
4.148 @@ -267,8 +261,7 @@
4.149 def get_cookies(self):
4.150
4.151 """
4.152 - A framework-specific method which obtains cookie information from the
4.153 - request.
4.154 + Obtains cookie information from the request.
4.155
4.156 Returns a dictionary mapping cookie names to cookie objects.
4.157 """
4.158 @@ -278,8 +271,7 @@
4.159 def get_cookie(self, cookie_name):
4.160
4.161 """
4.162 - A framework-specific method which obtains cookie information from the
4.163 - request.
4.164 + Obtains cookie information from the request.
4.165
4.166 Returns a cookie object for the given 'cookie_name' or None if no such
4.167 cookie exists.
4.168 @@ -292,8 +284,7 @@
4.169 def get_response_stream(self):
4.170
4.171 """
4.172 - A framework-specific method which returns the response stream for
4.173 - the transaction.
4.174 + Returns the response stream for the transaction.
4.175 """
4.176
4.177 return self.response.getOutputStream()
4.178 @@ -328,8 +319,7 @@
4.179 def set_content_type(self, content_type):
4.180
4.181 """
4.182 - A framework-specific method which sets the 'content_type' for the
4.183 - response.
4.184 + Sets the 'content_type' for the response.
4.185 """
4.186
4.187 return self.response.setHeader("Content-Type", self.format_content_type(content_type))
4.188 @@ -339,8 +329,7 @@
4.189 def set_cookie(self, cookie):
4.190
4.191 """
4.192 - A framework-specific method which stores the given 'cookie' object in
4.193 - the response.
4.194 + Stores the given 'cookie' object in the response.
4.195 """
4.196
4.197 new_cookie = javax.servlet.http.Cookie(cookie.name, cookie.value)
4.198 @@ -349,8 +338,7 @@
4.199 def set_cookie_value(self, name, value, path=None, expires=None):
4.200
4.201 """
4.202 - A framework-specific method which stores a cookie with the given 'name'
4.203 - and 'value' in the response.
4.204 + Stores a cookie with the given 'name' and 'value' in the response.
4.205
4.206 The optional 'path' is a string which specifies the scope of the cookie,
4.207 and the optional 'expires' parameter is a value compatible with the
4.208 @@ -368,9 +356,8 @@
4.209 def delete_cookie(self, cookie_name):
4.210
4.211 """
4.212 - A framework-specific method which adds to the response a request that
4.213 - the cookie with the given 'cookie_name' be deleted/discarded by the
4.214 - client.
4.215 + Adds to the response a request that the cookie with the given
4.216 + 'cookie_name' be deleted/discarded by the client.
4.217 """
4.218
4.219 # Create a special cookie, given that we do not know whether the browser
4.220 @@ -387,8 +374,8 @@
4.221 def get_session(self, create=1):
4.222
4.223 """
4.224 - A framework-specific method which returns a session corresponding to
4.225 - an identifier supplied in the transaction.
4.226 + Gets a session corresponding to an identifier supplied in the
4.227 + transaction.
4.228
4.229 If no session has yet been established according to information
4.230 provided in the transaction then the optional 'create' parameter
4.231 @@ -404,8 +391,8 @@
4.232 def expire_session(self):
4.233
4.234 """
4.235 - A framework-specific method which expires any session established
4.236 - according to information provided in the transaction.
4.237 + Expires any session established according to information provided in the
4.238 + transaction.
4.239 """
4.240
4.241 session = self.get_session(create=0)
5.1 --- a/WebStack/ModPython.py Thu Aug 26 20:37:56 2004 +0000
5.2 +++ b/WebStack/ModPython.py Thu Aug 26 21:07:45 2004 +0000
5.3 @@ -40,8 +40,7 @@
5.4 def get_request_stream(self):
5.5
5.6 """
5.7 - A framework-specific method which returns the request stream for
5.8 - the transaction.
5.9 + Returns the request stream for the transaction.
5.10 """
5.11
5.12 return self.trans
5.13 @@ -49,7 +48,7 @@
5.14 def get_request_method(self):
5.15
5.16 """
5.17 - A framework-specific method which gets the request method.
5.18 + Returns the request method.
5.19 """
5.20
5.21 return self.trans.method
5.22 @@ -57,8 +56,9 @@
5.23 def get_headers(self):
5.24
5.25 """
5.26 - A framework-specific method which returns all request headers as a
5.27 - dictionary-like object mapping header names to values.
5.28 + Returns all request headers as a dictionary-like object mapping header
5.29 + names to values.
5.30 +
5.31 NOTE: If duplicate header names are permitted, then this interface will
5.32 NOTE: need to change.
5.33 """
5.34 @@ -68,9 +68,9 @@
5.35 def get_header_values(self, key):
5.36
5.37 """
5.38 - A framework-specific method which returns a list of all request header
5.39 - values associated with the given 'key'. Note that according to RFC 2616,
5.40 - 'key' is treated as a case-insensitive string.
5.41 + Returns a list of all request header values associated with the given
5.42 + 'key'. Note that according to RFC 2616, 'key' is treated as a
5.43 + case-insensitive string.
5.44 """
5.45
5.46 return self.convert_to_list(self.trans.headers_in.get(key))
5.47 @@ -78,8 +78,8 @@
5.48 def get_content_type(self):
5.49
5.50 """
5.51 - A framework-specific method which gets the content type specified on the
5.52 - request, along with the charset employed.
5.53 + Returns the content type specified on the request, along with the
5.54 + charset employed.
5.55 """
5.56
5.57 return self.parse_content_type(self.trans.content_type)
5.58 @@ -95,8 +95,7 @@
5.59 def get_content_languages(self):
5.60
5.61 """
5.62 - A framework-specific method which extracts language information from
5.63 - the transaction.
5.64 + Returns extracted language information from the transaction.
5.65 """
5.66
5.67 return self.parse_content_preferences(self.trans.headers_in.get("Accept-Language"))
5.68 @@ -104,7 +103,7 @@
5.69 def get_path(self):
5.70
5.71 """
5.72 - A framework-specific method which gets the entire path from the request.
5.73 + Returns the entire path from the request.
5.74 """
5.75
5.76 query_string = self.get_query_string()
5.77 @@ -116,8 +115,7 @@
5.78 def get_path_without_query(self):
5.79
5.80 """
5.81 - A framework-specific method which gets the entire path from the request
5.82 - minus the query string.
5.83 + Returns the entire path from the request minus the query string.
5.84 """
5.85
5.86 return self.trans.uri
5.87 @@ -125,9 +123,8 @@
5.88 def get_path_info(self):
5.89
5.90 """
5.91 - A framework-specific method which gets the "path info" (the part of the
5.92 - URL after the resource name handling the current request) from the
5.93 - request.
5.94 + Returns the "path info" (the part of the URL after the resource name
5.95 + handling the current request) from the request.
5.96 """
5.97
5.98 return self.trans.path_info
5.99 @@ -135,8 +132,7 @@
5.100 def get_query_string(self):
5.101
5.102 """
5.103 - A framework-specific method which gets the query string from the path in
5.104 - the request.
5.105 + Returns the query string from the path in the request.
5.106 """
5.107
5.108 return self.trans.args or ""
5.109 @@ -146,9 +142,9 @@
5.110 def get_fields_from_path(self):
5.111
5.112 """
5.113 - A framework-specific method which extracts the form fields from the
5.114 - path specified in the transaction. The underlying framework may refuse
5.115 - to supply fields from the path if handling a POST transaction.
5.116 + Extracts the form fields from the path specified in the transaction. The
5.117 + underlying framework may refuse to supply fields from the path if
5.118 + handling a POST transaction.
5.119
5.120 Returns a dictionary mapping field names to lists of values (even if a
5.121 single value is associated with any given field name).
5.122 @@ -159,11 +155,10 @@
5.123 def get_fields_from_body(self, encoding=None):
5.124
5.125 """
5.126 - A framework-specific method which extracts the form fields from the
5.127 - message body in the transaction. The optional 'encoding' parameter
5.128 - specifies the character encoding of the message body for cases where no
5.129 - such information is available, but where the default encoding is to be
5.130 - overridden.
5.131 + Extracts the form fields from the message body in the transaction. The
5.132 + optional 'encoding' parameter specifies the character encoding of the
5.133 + message body for cases where no such information is available, but where
5.134 + the default encoding is to be overridden.
5.135
5.136 Returns a dictionary mapping field names to lists of values (even if a
5.137 single value is associated with any given field name).
5.138 @@ -189,8 +184,7 @@
5.139 def get_user(self):
5.140
5.141 """
5.142 - A framework-specific method which extracts user information from the
5.143 - transaction.
5.144 + Extracts user information from the transaction.
5.145
5.146 Returns a username as a string or None if no user is defined.
5.147 """
5.148 @@ -203,8 +197,7 @@
5.149 def get_cookies(self):
5.150
5.151 """
5.152 - A framework-specific method which obtains cookie information from the
5.153 - request.
5.154 + Obtains cookie information from the request.
5.155
5.156 Returns a dictionary mapping cookie names to cookie objects.
5.157
5.158 @@ -220,8 +213,7 @@
5.159 def get_cookie(self, cookie_name):
5.160
5.161 """
5.162 - A framework-specific method which obtains cookie information from the
5.163 - request.
5.164 + Obtains cookie information from the request.
5.165
5.166 Returns a cookie object for the given 'cookie_name' or None if no such
5.167 cookie exists.
5.168 @@ -234,8 +226,7 @@
5.169 def get_response_stream(self):
5.170
5.171 """
5.172 - A framework-specific method which returns the response stream for
5.173 - the transaction.
5.174 + Returns the response stream for the transaction.
5.175 """
5.176
5.177 # Unicode can upset this operation. Using either the specified charset,
5.178 @@ -275,8 +266,7 @@
5.179 def set_content_type(self, content_type):
5.180
5.181 """
5.182 - A framework-specific method which sets the 'content_type' for the
5.183 - response.
5.184 + Sets the 'content_type' for the response.
5.185 """
5.186
5.187 # Remember the content type for encoding purposes later.
5.188 @@ -284,11 +274,12 @@
5.189 self.content_type = content_type
5.190 self.trans.content_type = self.format_content_type(content_type)
5.191
5.192 + # Higher level response-related methods.
5.193 +
5.194 def set_cookie(self, cookie):
5.195
5.196 """
5.197 - A framework-specific method which stores the given 'cookie' object in
5.198 - the response.
5.199 + Stores the given 'cookie' object in the response.
5.200 """
5.201
5.202 if Cookie:
5.203 @@ -300,8 +291,7 @@
5.204 def set_cookie_value(self, name, value, path=None, expires=None):
5.205
5.206 """
5.207 - A framework-specific method which stores a cookie with the given 'name'
5.208 - and 'value' in the response.
5.209 + Stores a cookie with the given 'name' and 'value' in the response.
5.210
5.211 The optional 'path' is a string which specifies the scope of the cookie,
5.212 and the optional 'expires' parameter is a value compatible with the
5.213 @@ -324,9 +314,8 @@
5.214 def delete_cookie(self, cookie_name):
5.215
5.216 """
5.217 - A framework-specific method which adds to the response a request that
5.218 - the cookie with the given 'cookie_name' be deleted/discarded by the
5.219 - client.
5.220 + Adds to the response a request that the cookie with the given
5.221 + 'cookie_name' be deleted/discarded by the client.
5.222 """
5.223
5.224 # Create a special cookie, given that we do not know whether the browser
5.225 @@ -348,8 +337,8 @@
5.226 def get_session(self, create=1):
5.227
5.228 """
5.229 - A framework-specific method which returns a session corresponding to
5.230 - an identifier supplied in the transaction.
5.231 + Gets a session corresponding to an identifier supplied in the
5.232 + transaction.
5.233
5.234 If no session has yet been established according to information
5.235 provided in the transaction then the optional 'create' parameter
5.236 @@ -369,8 +358,8 @@
5.237 def expire_session(self):
5.238
5.239 """
5.240 - A framework-specific method which expires any session established
5.241 - according to information provided in the transaction.
5.242 + Expires any session established according to information provided in the
5.243 + transaction.
5.244 """
5.245
5.246 session = self.get_session(create=0)
6.1 --- a/WebStack/Twisted.py Thu Aug 26 20:37:56 2004 +0000
6.2 +++ b/WebStack/Twisted.py Thu Aug 26 21:07:45 2004 +0000
6.3 @@ -29,8 +29,7 @@
6.4 def get_request_stream(self):
6.5
6.6 """
6.7 - A framework-specific method which returns the request stream for
6.8 - the transaction.
6.9 + Returns the request stream for the transaction.
6.10 """
6.11
6.12 return self.trans.content
6.13 @@ -38,7 +37,7 @@
6.14 def get_request_method(self):
6.15
6.16 """
6.17 - A framework-specific method which gets the request method.
6.18 + Returns the request method.
6.19 """
6.20
6.21 return self.trans.method
6.22 @@ -46,8 +45,9 @@
6.23 def get_headers(self):
6.24
6.25 """
6.26 - A framework-specific method which returns all request headers as a
6.27 - dictionary-like object mapping header names to values.
6.28 + Returns all request headers as a dictionary-like object mapping header
6.29 + names to values.
6.30 +
6.31 NOTE: If duplicate header names are permitted, then this interface will
6.32 NOTE: need to change.
6.33 """
6.34 @@ -57,9 +57,9 @@
6.35 def get_header_values(self, key):
6.36
6.37 """
6.38 - A framework-specific method which returns a list of all request header
6.39 - values associated with the given 'key'. Note that according to RFC 2616,
6.40 - 'key' is treated as a case-insensitive string.
6.41 + Returns a list of all request header values associated with the given
6.42 + 'key'. Note that according to RFC 2616, 'key' is treated as a
6.43 + case-insensitive string.
6.44 """
6.45
6.46 # Twisted does not convert the header key to lower case (which is the
6.47 @@ -70,8 +70,8 @@
6.48 def get_content_type(self):
6.49
6.50 """
6.51 - A framework-specific method which gets the content type specified on the
6.52 - request, along with the charset employed.
6.53 + Returns the content type specified on the request, along with the
6.54 + charset employed.
6.55 """
6.56
6.57 return self.parse_content_type(self.trans.getHeader("Content-Type"))
6.58 @@ -87,8 +87,7 @@
6.59 def get_content_languages(self):
6.60
6.61 """
6.62 - A framework-specific method which extracts language information from
6.63 - the transaction.
6.64 + Returns extracted language information from the transaction.
6.65 """
6.66
6.67 return self.parse_content_preferences(self.trans.getHeader("Accept-Charset"))
6.68 @@ -96,7 +95,7 @@
6.69 def get_path(self):
6.70
6.71 """
6.72 - A framework-specific method which gets the entire path from the request.
6.73 + Returns the entire path from the request.
6.74 """
6.75
6.76 return self.trans.uri
6.77 @@ -104,8 +103,7 @@
6.78 def get_path_without_query(self):
6.79
6.80 """
6.81 - A framework-specific method which gets the entire path from the request
6.82 - minus the query string.
6.83 + Returns the entire path from the request minus the query string.
6.84 """
6.85
6.86 return self.get_path().split("?")[0]
6.87 @@ -113,9 +111,8 @@
6.88 def get_path_info(self):
6.89
6.90 """
6.91 - A framework-specific method which gets the "path info" (the part of the
6.92 - URL after the resource name handling the current request) from the
6.93 - request.
6.94 + Returns the "path info" (the part of the URL after the resource name
6.95 + handling the current request) from the request.
6.96 """
6.97
6.98 return "/%s" % "/".join(self.trans.postpath)
6.99 @@ -123,8 +120,7 @@
6.100 def get_query_string(self):
6.101
6.102 """
6.103 - A framework-specific method which gets the query string from the path in
6.104 - the request.
6.105 + Returns the query string from the path in the request.
6.106 """
6.107
6.108 t = self.get_path().split("?")
6.109 @@ -141,9 +137,9 @@
6.110 def get_fields_from_path(self):
6.111
6.112 """
6.113 - A framework-specific method which extracts the form fields from the
6.114 - path specified in the transaction. The underlying framework may refuse
6.115 - to supply fields from the path if handling a POST transaction.
6.116 + Extracts the form fields from the path specified in the transaction. The
6.117 + underlying framework may refuse to supply fields from the path if
6.118 + handling a POST transaction.
6.119
6.120 Returns a dictionary mapping field names to lists of values (even if a
6.121 single value is associated with any given field name).
6.122 @@ -154,11 +150,10 @@
6.123 def get_fields_from_body(self, encoding=None):
6.124
6.125 """
6.126 - A framework-specific method which extracts the form fields from the
6.127 - message body in the transaction. The optional 'encoding' parameter
6.128 - specifies the character encoding of the message body for cases where no
6.129 - such information is available, but where the default encoding is to be
6.130 - overridden.
6.131 + Extracts the form fields from the message body in the transaction. The
6.132 + optional 'encoding' parameter specifies the character encoding of the
6.133 + message body for cases where no such information is available, but where
6.134 + the default encoding is to be overridden.
6.135
6.136 Returns a dictionary mapping field names to lists of values (even if a
6.137 single value is associated with any given field name).
6.138 @@ -175,8 +170,7 @@
6.139 def get_user(self):
6.140
6.141 """
6.142 - A framework-specific method which extracts user information from the
6.143 - transaction.
6.144 + Extracts user information from the transaction.
6.145
6.146 Returns a username as a string or None if no user is defined.
6.147 """
6.148 @@ -195,8 +189,7 @@
6.149 def get_cookies(self):
6.150
6.151 """
6.152 - A framework-specific method which obtains cookie information from the
6.153 - request.
6.154 + Obtains cookie information from the request.
6.155
6.156 Returns a dictionary mapping cookie names to cookie objects.
6.157 NOTE: Twisted does not seem to support this operation via methods. Thus,
6.158 @@ -213,8 +206,7 @@
6.159 def get_cookie(self, cookie_name):
6.160
6.161 """
6.162 - A framework-specific method which obtains cookie information from the
6.163 - request.
6.164 + Obtains cookie information from the request.
6.165
6.166 Returns a cookie object for the given 'cookie_name' or None if no such
6.167 cookie exists.
6.168 @@ -229,8 +221,7 @@
6.169 def get_response_stream(self):
6.170
6.171 """
6.172 - A framework-specific method which returns the response stream for
6.173 - the transaction.
6.174 + Returns the response stream for the transaction.
6.175 """
6.176
6.177 # Unicode can upset this operation. Using either the specified charset,
6.178 @@ -272,8 +263,7 @@
6.179 def set_content_type(self, content_type):
6.180
6.181 """
6.182 - A framework-specific method which sets the 'content_type' for the
6.183 - response.
6.184 + Sets the 'content_type' for the response.
6.185 """
6.186
6.187 # Remember the content type for encoding purposes later.
6.188 @@ -286,8 +276,7 @@
6.189 def set_cookie(self, cookie):
6.190
6.191 """
6.192 - A framework-specific method which stores the given 'cookie' object in
6.193 - the response.
6.194 + Stores the given 'cookie' object in the response.
6.195 """
6.196
6.197 self.trans.addCookie(cookie.name, cookie.value, expires=cookie.expires, path=cookie.path)
6.198 @@ -295,8 +284,7 @@
6.199 def set_cookie_value(self, name, value, path=None, expires=None):
6.200
6.201 """
6.202 - A framework-specific method which stores a cookie with the given 'name'
6.203 - and 'value' in the response.
6.204 + Stores a cookie with the given 'name' and 'value' in the response.
6.205
6.206 The optional 'path' is a string which specifies the scope of the cookie,
6.207 and the optional 'expires' parameter is a value compatible with the
6.208 @@ -309,9 +297,8 @@
6.209 def delete_cookie(self, cookie_name):
6.210
6.211 """
6.212 - A framework-specific method which adds to the response a request that
6.213 - the cookie with the given 'cookie_name' be deleted/discarded by the
6.214 - client.
6.215 + Adds to the response a request that the cookie with the given
6.216 + 'cookie_name' be deleted/discarded by the client.
6.217 """
6.218
6.219 # Create a special cookie, given that we do not know whether the browser
7.1 --- a/WebStack/Webware.py Thu Aug 26 20:37:56 2004 +0000
7.2 +++ b/WebStack/Webware.py Thu Aug 26 21:07:45 2004 +0000
7.3 @@ -30,8 +30,7 @@
7.4 def get_request_stream(self):
7.5
7.6 """
7.7 - A framework-specific method which returns the request stream for
7.8 - the transaction.
7.9 + Returns the request stream for the transaction.
7.10 """
7.11
7.12 request = self.trans.request()
7.13 @@ -51,7 +50,7 @@
7.14 def get_request_method(self):
7.15
7.16 """
7.17 - A framework-specific method which gets the request method.
7.18 + Returns the request method.
7.19 """
7.20
7.21 return self.trans.request().method()
7.22 @@ -59,8 +58,9 @@
7.23 def get_headers(self):
7.24
7.25 """
7.26 - A framework-specific method which returns all request headers as a
7.27 - dictionary-like object mapping header names to values.
7.28 + Returns all request headers as a dictionary-like object mapping header
7.29 + names to values.
7.30 +
7.31 NOTE: If duplicate header names are permitted, then this interface will
7.32 NOTE: need to change.
7.33 """
7.34 @@ -74,9 +74,9 @@
7.35 def get_header_values(self, key):
7.36
7.37 """
7.38 - A framework-specific method which returns a list of all request header
7.39 - values associated with the given 'key'. Note that according to RFC 2616,
7.40 - 'key' is treated as a case-insensitive string.
7.41 + Returns a list of all request header values associated with the given
7.42 + 'key'. Note that according to RFC 2616, 'key' is treated as a
7.43 + case-insensitive string.
7.44 """
7.45
7.46 # Use the Webware environment and some assumptions about variable names.
7.47 @@ -91,8 +91,8 @@
7.48 def get_content_type(self):
7.49
7.50 """
7.51 - A framework-specific method which gets the content type specified on the
7.52 - request, along with the charset employed.
7.53 + Returns the content type specified on the request, along with the
7.54 + charset employed.
7.55 """
7.56
7.57 return self.parse_content_type(self.trans.request().contentType())
7.58 @@ -109,8 +109,7 @@
7.59 def get_content_languages(self):
7.60
7.61 """
7.62 - A framework-specific method which extracts language information from
7.63 - the transaction.
7.64 + Returns extracted language information from the transaction.
7.65 NOTE: Requires enhancements to HTTPRequest.
7.66 """
7.67
7.68 @@ -119,7 +118,7 @@
7.69 def get_path(self):
7.70
7.71 """
7.72 - A framework-specific method which gets the entire path from the request.
7.73 + Returns the entire path from the request.
7.74 """
7.75
7.76 return self.trans.request().uri()
7.77 @@ -127,8 +126,7 @@
7.78 def get_path_without_query(self):
7.79
7.80 """
7.81 - A framework-specific method which gets the entire path from the request
7.82 - minus the query string.
7.83 + Returns the entire path from the request minus the query string.
7.84 """
7.85
7.86 return self.get_path().split("?")[0]
7.87 @@ -136,9 +134,8 @@
7.88 def get_path_info(self):
7.89
7.90 """
7.91 - A framework-specific method which gets the "path info" (the part of the
7.92 - URL after the resource name handling the current request) from the
7.93 - request.
7.94 + Returns the "path info" (the part of the URL after the resource name
7.95 + handling the current request) from the request.
7.96 """
7.97
7.98 return self.trans.request().extraURLPath()
7.99 @@ -146,8 +143,7 @@
7.100 def get_query_string(self):
7.101
7.102 """
7.103 - A framework-specific method which gets the query string from the path in
7.104 - the request.
7.105 + Returns the query string from the path in the request.
7.106 """
7.107
7.108 return self.trans.request().queryString()
7.109 @@ -157,9 +153,9 @@
7.110 def get_fields_from_path(self):
7.111
7.112 """
7.113 - A framework-specific method which extracts the form fields from the
7.114 - path specified in the transaction. The underlying framework may refuse
7.115 - to supply fields from the path if handling a POST transaction.
7.116 + Extracts the form fields from the path specified in the transaction. The
7.117 + underlying framework may refuse to supply fields from the path if
7.118 + handling a POST transaction.
7.119
7.120 Returns a dictionary mapping field names to lists of values (even if a
7.121 single value is associated with any given field name).
7.122 @@ -170,11 +166,10 @@
7.123 def get_fields_from_body(self, encoding=None):
7.124
7.125 """
7.126 - A framework-specific method which extracts the form fields from the
7.127 - message body in the transaction. The optional 'encoding' parameter
7.128 - specifies the character encoding of the message body for cases where no
7.129 - such information is available, but where the default encoding is to be
7.130 - overridden.
7.131 + Extracts the form fields from the message body in the transaction. The
7.132 + optional 'encoding' parameter specifies the character encoding of the
7.133 + message body for cases where no such information is available, but where
7.134 + the default encoding is to be overridden.
7.135
7.136 Returns a dictionary mapping field names to lists of values (even if a
7.137 single value is associated with any given field name).
7.138 @@ -197,8 +192,7 @@
7.139 def get_user(self):
7.140
7.141 """
7.142 - A framework-specific method which extracts user information from the
7.143 - transaction.
7.144 + Extracts user information from the transaction.
7.145
7.146 Returns a username as a string or None if no user is defined.
7.147 """
7.148 @@ -218,8 +212,7 @@
7.149 def get_cookies(self):
7.150
7.151 """
7.152 - A framework-specific method which obtains cookie information from the
7.153 - request.
7.154 + Obtains cookie information from the request.
7.155
7.156 Returns a dictionary mapping cookie names to cookie objects.
7.157 """
7.158 @@ -232,8 +225,7 @@
7.159 def get_cookie(self, cookie_name):
7.160
7.161 """
7.162 - A framework-specific method which obtains cookie information from the
7.163 - request.
7.164 + Obtains cookie information from the request.
7.165
7.166 Returns a cookie object for the given 'cookie_name' or None if no such
7.167 cookie exists.
7.168 @@ -249,8 +241,7 @@
7.169 def get_response_stream(self):
7.170
7.171 """
7.172 - A framework-specific method which returns the response stream for
7.173 - the transaction.
7.174 + Returns the response stream for the transaction.
7.175 """
7.176
7.177 # Unicode can upset this operation. Using either the specified charset,
7.178 @@ -299,8 +290,7 @@
7.179 def set_content_type(self, content_type):
7.180
7.181 """
7.182 - A framework-specific method which sets the 'content_type' for the
7.183 - response.
7.184 + Sets the 'content_type' for the response.
7.185 """
7.186
7.187 # Remember the content type for encoding purposes later.
7.188 @@ -313,8 +303,7 @@
7.189 def set_cookie(self, cookie):
7.190
7.191 """
7.192 - A framework-specific method which stores the given 'cookie' object in
7.193 - the response.
7.194 + Stores the given 'cookie' object in the response.
7.195 """
7.196
7.197 self.trans.response().addCookie(cookie)
7.198 @@ -322,8 +311,7 @@
7.199 def set_cookie_value(self, name, value, path=None, expires=None):
7.200
7.201 """
7.202 - A framework-specific method which stores a cookie with the given 'name'
7.203 - and 'value' in the response.
7.204 + Stores a cookie with the given 'name' and 'value' in the response.
7.205
7.206 The optional 'path' is a string which specifies the scope of the cookie,
7.207 and the optional 'expires' parameter is a value compatible with the
7.208 @@ -335,9 +323,8 @@
7.209 def delete_cookie(self, cookie_name):
7.210
7.211 """
7.212 - A framework-specific method which adds to the response a request that
7.213 - the cookie with the given 'cookie_name' be deleted/discarded by the
7.214 - client.
7.215 + Adds to the response a request that the cookie with the given
7.216 + 'cookie_name' be deleted/discarded by the client.
7.217 """
7.218
7.219 self.trans.response().delCookie(cookie_name)
7.220 @@ -347,8 +334,8 @@
7.221 def get_session(self, create=1):
7.222
7.223 """
7.224 - A framework-specific method which returns a session corresponding to
7.225 - an identifier supplied in the transaction.
7.226 + Gets a session corresponding to an identifier supplied in the
7.227 + transaction.
7.228
7.229 If no session has yet been established according to information
7.230 provided in the transaction then the optional 'create' parameter
7.231 @@ -367,8 +354,8 @@
7.232 def expire_session(self):
7.233
7.234 """
7.235 - A framework-specific method which expires any session established
7.236 - according to information provided in the transaction.
7.237 + Expires any session established according to information provided in the
7.238 + transaction.
7.239 """
7.240
7.241 self.trans.request().setSessionExpired(1)