Package openid :: Module message :: Class Message
[frames | no frames]

Type Message

object --+
         |
        Message


In the implementation of this object, None represents the global namespace as well as a namespace with no key.
Method Summary
  __init__(self, openid_namespace)
Create an empty Message
  __eq__(self, other)
  __ne__(self, other)
  __repr__(self)
  copy(self)
  delArg(self, namespace, key)
  fromKVForm(cls, kvform_string)
Create a Message from a KVForm string (Class method)
  fromOpenIDArgs(cls, openid_args)
Construct a Message from a parsed KVForm message (Class method)
  fromPostArgs(cls, args)
Construct a Message containing a set of POST arguments (Class method)
  getAliasedArg(self, aliased_key, default)
str or the type of default getArg(self, namespace, key, default)
Get a value for a namespaced key.
dict getArgs(self, namespace)
Get the arguments that are defined for this namespace URI
  getKey(self, namespace, ns_key)
Get the key for a particular namespaced argument
  getOpenIDNamespace(self)
  hasKey(self, namespace, ns_key)
  isOpenID1(self)
  isOpenID2(self)
  setArg(self, namespace, key, value)
Set a single argument in this namespace
  setOpenIDNamespace(self, openid_ns_uri)
  toArgs(self)
Return all namespaced arguments, failing if any non-namespaced arguments exist.
str or unicode toFormMarkup(self, action_url, form_tag_attrs, submit_text)
Generate HTML form markup that contains the values in this message, to be HTTP POSTed as x-www-form-urlencoded UTF-8.
  toKVForm(self)
Generate a KVForm string that contains the parameters in this message.
  toPostArgs(self)
Return all arguments with openid.
  toURL(self, base_url)
Generate a GET URL with the parameters in this message attached as query parameters.
  toURLEncoded(self)
Generate an x-www-urlencoded string
  updateArgs(self, namespace, updates)
Set multiple key/value pairs in one call
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Instance Variable Summary
  ns_args: two-level dictionary of the values in this message, grouped by namespace URI.

Class Variable Summary
list allowed_openid_namespaces = ['http://openid.net/signon/1...
  namespaces: A dictionary specifying specific namespace-URI to alias mappings that should be used when generating namespace aliases.

Instance Method Details

__init__(self, openid_namespace=None)
(Constructor)

Create an empty Message
Overrides:
__builtin__.object.__init__

getArg(self, namespace, key, default=None)

Get a value for a namespaced key.
Parameters:
namespace - The namespace in the message for this key
           (type=str)
key - The key to get within this namespace
           (type=str)
default - The value to use if this key is absent from this message. Using the special value openid.message.no_default will result in this method raising a KeyError instead of returning the default.
Returns:
str or the type of default
Raises:
KeyError - if default is no_default
UndefinedOpenIDNamespace - if the message has not yet had an OpenID namespace set

getArgs(self, namespace)

Get the arguments that are defined for this namespace URI
Returns:
mapping from namespaced keys to values
           (type=dict)

getKey(self, namespace, ns_key)

Get the key for a particular namespaced argument

setArg(self, namespace, key, value)

Set a single argument in this namespace

toArgs(self)

Return all namespaced arguments, failing if any non-namespaced arguments exist.

toFormMarkup(self, action_url, form_tag_attrs=None, submit_text='Continue')

Generate HTML form markup that contains the values in this message, to be HTTP POSTed as x-www-form-urlencoded UTF-8.
Parameters:
action_url - The URL to which the form will be POSTed
           (type=str)
form_tag_attrs - Dictionary of attributes to be added to the form tag. 'accept-charset' and 'enctype' have defaults that can be overridden. If a value is supplied for 'action' or 'method', it will be replaced.
           (type={unicode: unicode})
submit_text - The text that will appear on the submit button for this form.
           (type=unicode)
Returns:
A string containing (X)HTML markup for a form that encodes the values in this Message object.
           (type=str or unicode)

toKVForm(self)

Generate a KVForm string that contains the parameters in this message. This will fail if the message contains arguments outside of the 'openid.' prefix.

toPostArgs(self)

Return all arguments with openid. in front of namespaced arguments.

toURL(self, base_url)

Generate a GET URL with the parameters in this message attached as query parameters.

toURLEncoded(self)

Generate an x-www-urlencoded string

updateArgs(self, namespace, updates)

Set multiple key/value pairs in one call
Parameters:
updates - The values to set
           (type={unicode:unicode})

Class Method Details

fromKVForm(cls, kvform_string)

Create a Message from a KVForm string

fromOpenIDArgs(cls, openid_args)

Construct a Message from a parsed KVForm message

fromPostArgs(cls, args)

Construct a Message containing a set of POST arguments

Instance Variable Details

ns_args

two-level dictionary of the values in this message, grouped by namespace URI. The first level is the namespace URI.

Class Variable Details

allowed_openid_namespaces

Type:
list
Value:
['http://openid.net/signon/1.0', 'http://specs.openid.net/auth/2.0']   

namespaces

A dictionary specifying specific namespace-URI to alias mappings that should be used when generating namespace aliases.

Generated by Epydoc 2.1 on Wed Nov 14 17:47:20 2007 http://epydoc.sf.net