Table of Contents

Class: WebRequest qm/web.py

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.

Methods   
AsForm
AsUrl
GetScriptName
GetSession
GetSessionId
GetUrl
SetSessionId
__delitem__
__getitem__
__init__
__setitem__
__str__
copy
get
has_key
items
keys
  AsForm 
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.

Exceptions   
ValueError, "unknown method %s" % method
  AsUrl 
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).
  GetScriptName 
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 
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.
Exceptions   
NoSessionError, qm.error( "session required" )
  GetSessionId 
GetSessionId ( self )

Return the session ID for this request.

returns
A session ID, or None.
  GetUrl 
GetUrl ( self )

Return the URL of the script that processes this request.

  SetSessionId 
SetSessionId ( self,  session_id )

Set the session ID for this request to session_id.

  __delitem__ 
__delitem__ ( self,  key )

  __getitem__ 
__getitem__ ( self,  key )

  __init__ 
__init__ (
        self,
        script_url,
        base=None,
        **fields,
        )

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.
  __setitem__ 
__setitem__ (
        self,
        key,
        value,
        )

  __str__ 
__str__ ( self )

  copy 
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.
  get 
get (
        self,
        key,
        default=None,
        )

  has_key 
has_key ( self,  key )

  items 
items ( self )

  keys 
keys ( self )


Table of Contents

This document was automatically generated on Mon Jan 3 09:42:29 2005 by HappyDoc version 2.1