Trees | Index | Help |
---|
Package WebStack :: Module Generic :: Class Transaction |
|
Method Summary | |
---|---|
A special method, synchronising the transaction with framework-specific objects. | |
Returns a single element list containing 'value' if it is not itself a list, a tuple, or None. | |
Decode the given cookie 'value'. | |
Adds to the response a request that the cookie with the given 'cookie_name' be deleted/discarded by the client. | |
Encode the given cookie 'value'. | |
Expires any session established according to information provided in the transaction. | |
Format the given header 'value'. | |
Returns the character set preferences. | |
Returns extracted language information from the transaction. | |
Returns the content type specified on the request, along with the charset employed. | |
Obtains cookie information from the request. | |
Obtains cookie information from the request. | |
Extracts fields (or request parameters) from both the path specified in the transaction as well as the message body. | |
Extracts fields (or request parameters) from the message body in the transaction. | |
Extracts fields (or request parameters) from the path specified in the transaction. | |
Returns a list of all request header values associated with the given 'key'. | |
Returns all request headers as a dictionary-like object mapping header names to values. | |
Returns the entire path from the request. | |
Returns the "path info" (the part of the URL after the resource name handling the current request) from the request. | |
Returns the entire path from the request minus the query string. | |
Returns the query string from the path in the request. | |
Returns the request method. | |
Returns the request stream for the transaction. | |
Get the response code associated with the transaction. | |
Returns the response stream for the transaction. | |
Returns the response stream encoding. | |
Returns the server name. | |
Returns the server port as a string. | |
Gets a session corresponding to an identifier supplied in the transaction. | |
Extracts user information from the transaction. | |
An application-specific method which either returns path info set in the 'set_virtual_path_info' method, or the normal path info found in the request. | |
Returns the preferences as requested by the user agent. | |
Parse the given 'content_type_field' - a value found comparable to that found in an HTTP request header for "Content-Type". | |
Create an object of the given 'header_class' by determining the details of the given 'header_value_str' - a string containing the value of a particular header. | |
Process the given 'cookie_dict', returning a dictionary mapping cookie names to cookie objects where the names and values have been decoded from the form used in the cookies retrieved from the request. | |
Sets the 'content_type' for the response. | |
Stores the given 'cookie' object in the response. | |
Stores a cookie with the given 'name' and 'value' in the response. | |
Set the HTTP 'header' with the given 'value'. | |
Set the 'response_code' using a numeric constant defined in the HTTP specification. | |
An application-specific method which sets the user information with 'username' in the transaction. | |
An application-specific method which sets the 'path_info' in the transaction. |
Class Variable Summary | |
---|---|
str |
default_charset = 'iso-8859-1'
|
Method Details |
---|
commit(self)A special method, synchronising the transaction with framework-specific objects. |
convert_to_list(self, value)Returns a single element list containing 'value' if it is not itself a list, a tuple, or None. If 'value' is a list then it is itself returned; if 'value' is a tuple then a new list containing the same elements is returned; if 'value' is None then an empty list is returned. |
decode_cookie_value(self, value)Decode the given cookie 'value'. |
delete_cookie(self, cookie_name)Adds to the response a request that the cookie with the given 'cookie_name' be deleted/discarded by the client. |
encode_cookie_value(self, value)Encode the given cookie 'value'. This ensures the usage of US-ASCII through the encoding of Unicode objects as URL-encoded UTF-8 text. |
expire_session(self)Expires any session established according to information provided in the transaction. |
format_header_value(self, value)Format the given header 'value'. Typically, this just ensures the usage of US-ASCII. |
get_content_charsets(self)Returns the character set preferences. |
get_content_languages(self)Returns extracted language information from the transaction. |
get_content_type(self)Returns the content type specified on the request, along with the charset employed. |
get_cookie(self, cookie_name)Obtains cookie information from the request. Returns a cookie object for the given 'cookie_name' or None if no such cookie exists. |
get_cookies(self)Obtains cookie information from the request. Returns a dictionary mapping cookie names to cookie objects. |
get_fields(self, encoding=None)Extracts fields (or request parameters) from both the path specified in the transaction as well as the message body. The optional 'encoding' parameter specifies the character encoding of the message body for cases where no such information is available, but where the default encoding is to be overridden. Returns a dictionary mapping field names to lists of values (even if a single value is associated with any given field name). Each value is either a Unicode object (representing a simple form field, for example) or a plain string (representing a file upload form field, for example). Where a given field name is used in both the path and message body to specify values, the values from both sources will be combined into a single list associated with that field name. |
get_fields_from_body(self, encoding=None)Extracts fields (or request parameters) from the message body in the transaction. The optional 'encoding' parameter specifies the character encoding of the message body for cases where no such information is available, but where the default encoding is to be overridden. Returns a dictionary mapping field names to lists of values (even if a single value is associated with any given field name). Each value is either a Unicode object (representing a simple form field, for example) or a plain string (representing a file upload form field, for example). |
get_fields_from_path(self)Extracts fields (or request parameters) from the path specified in the transaction. The underlying framework may refuse to supply fields from the path if handling a POST transaction. Returns a dictionary mapping field names to lists of values (even if a single value is associated with any given field name). |
get_header_values(self, key)Returns a list of all request header values associated with the given 'key'. Note that according to RFC 2616, 'key' is treated as a case-insensitive string. |
get_headers(self)Returns all request headers as a dictionary-like object mapping header names to values. |
get_path(self)Returns the entire path from the request. |
get_path_info(self)Returns the "path info" (the part of the URL after the resource name handling the current request) from the request. |
get_path_without_query(self)Returns the entire path from the request minus the query string. |
get_query_string(self)Returns the query string from the path in the request. |
get_request_method(self)Returns the request method. |
get_request_stream(self)Returns the request stream for the transaction. |
get_response_code(self)Get the response code associated with the transaction. If no response code is defined, None is returned. |
get_response_stream(self)Returns the response stream for the transaction. |
get_response_stream_encoding(self)Returns the response stream encoding. |
get_server_name(self)Returns the server name. |
get_server_port(self)Returns the server port as a string. |
get_session(self, create=1)Gets a session corresponding to an identifier supplied in the transaction. If no session has yet been established according to information provided in the transaction then the optional 'create' parameter determines whether a new session will be established. Where no session has been established and where 'create' is set to 0 then None is returned. In all other cases, a session object is created (where appropriate) and returned. |
get_user(self)Extracts user information from the transaction. Returns a username as a string or None if no user is defined. |
get_virtual_path_info(self)An application-specific method which either returns path info set in the 'set_virtual_path_info' method, or the normal path info found in the request. |
parse_content_preferences(self, accept_preference)Returns the preferences as requested by the user agent. The preferences are returned as a list of codes in the same order as they appeared in the appropriate environment variable. In other words, the explicit weighting criteria are ignored. As the 'accept_preference' parameter, values for language and charset preferences are appropriate. |
parse_content_type(self, content_type_field)Parse the given 'content_type_field' - a value found comparable to that found in an HTTP request header for "Content-Type". |
parse_header_value(self, header_class, header_value_str)Create an object of the given 'header_class' by determining the details of the given 'header_value_str' - a string containing the value of a particular header. |
process_cookies(self, cookie_dict, using_strings=0)Process the given 'cookie_dict', returning a dictionary mapping cookie names to cookie objects where the names and values have been decoded from the form used in the cookies retrieved from the request. The optional 'using_strings', if set to 1, treats the 'cookie_dict' as a mapping of cookie names to values. |
set_content_type(self, content_type)Sets the 'content_type' for the response. |
set_cookie(self, cookie)Stores the given 'cookie' object in the response. |
set_cookie_value(self, name, value, path=None, expires=None)Stores a cookie with the given 'name' and 'value' in the response. The optional 'path' is a string which specifies the scope of the cookie, and the optional 'expires' parameter is a value compatible with the time.time function, and indicates the expiry date/time of the cookie. |
set_header_value(self, header, value)Set the HTTP 'header' with the given 'value'. |
set_response_code(self, response_code)Set the 'response_code' using a numeric constant defined in the HTTP specification. |
set_user(self, username)An application-specific method which sets the user information with 'username' in the transaction. This affects subsequent calls to 'get_user'. |
set_virtual_path_info(self, path_info)An application-specific method which sets the 'path_info' in the transaction. This affects subsequent calls to 'get_virtual_path_info'. |
Class Variable Details |
---|
default_charset
|
Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Sun May 1 20:27:34 2005 | http://epydoc.sf.net |