Package qm :: Module web :: Class WebRequest
[show private | hide private]
[frames | no frames]

Class WebRequest


An object representing a request from the web server.

A 'WebRequest' object behaves as a dictionary of key, value pairs representing query arguments, for instance query fields in a POST, or arguments encoded in a URL query string. It has some other methods as well.
Method Summary
  __init__(self, script_url, base, keep_fields, **fields)
Create a new request object.
  __delitem__(self, key)
  __getitem__(self, key)
  __setitem__(self, key, value)
  __str__(self)
  AsForm(self, method, name)
Return an opening form tag for this request.
  AsUrl(self, last_argument)
Return the URL representation of this request.
  copy(self, url, **fields)
Return a duplicate of this request.
  get(self, key, default)
  GetScriptName(self)
Return the name of the script that processes this request.
  GetSession(self)
Return the session for this request.
  GetSessionId(self)
Return the session ID for this request.
  GetUrl(self)
Return the URL of the script that processes this request.
  has_key(self, key)
  items(self)
  keys(self)
  SetSessionId(self, session_id)
Set the session ID for this request to 'session_id'.

Method Details

__init__(self, script_url, base=None, keep_fields=False, **fields)
(Constructor)

Create a new request object.

'script_url' -- The URL of the script that processes this query.

'base' -- A request object from which the session ID will be duplicated, or 'None'.

'fields' -- The query arguments.

AsForm(self, method='get', name=None)

Return an opening form tag for this request.

'method' -- The HTML method to use for the form, either "get" or "post".

'name' -- A name for the form, or 'None'.

returns -- An opening form tag for the request, plus hidden input elements for arguments to the request.

The caller must add additional inputs, the submit input, and close the form tag.

AsUrl(self, last_argument=None)

Return the URL representation of this request.

'fields_at_end' -- If not 'None', the name of the URL query arguments that should be placed last in the list of arugmnets (other than this, the order of query arguments is not defined).

copy(self, url=None, **fields)

Return a duplicate of this request.

'url' -- The URL for the request copy. If 'None', use the URL of the source.

'**fields' -- Additional fields to set in the copy.

GetScriptName(self)

Return the name of the script that processes this request.

The script name is the final element of the full URL path.

GetSession(self)

Return the session for this request.

raises -- 'NoSessionError' if no session ID is specified in the request.

raises -- 'InvalidSessionError' if the session ID specified in the request is invalid.

GetSessionId(self)

Return the session ID for this request.

returns -- A session ID, or 'None'.

GetUrl(self)

Return the URL of the script that processes this request.

SetSessionId(self, session_id)

Set the session ID for this request to 'session_id'.

Generated by Epydoc 2.1 on Thu Sep 27 15:49:06 2007 http://epydoc.sf.net