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

Class Message

source code

object --+
         |
        Message

In the implementation of this object, None represents the global namespace as well as a namespace with no key.

Instance Methods [hide private]
  __init__(self, openid_namespace=None)
Create an empty Message
  setOpenIDNamespace(self, openid_ns_uri)
  getOpenIDNamespace(self)
  isOpenID1(self)
  isOpenID2(self)
  copy(self)
  toPostArgs(self)
Return all arguments with openid.
  toArgs(self)
Return all namespaced arguments, failing if any non-namespaced arguments exist.
str or unicode 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.
  toURL(self, base_url)
Generate a GET URL with the parameters in this message attached as query parameters.
  toKVForm(self)
Generate a KVForm string that contains the parameters in this message.
  toURLEncoded(self)
Generate an x-www-urlencoded string
  hasKey(self, namespace, ns_key)
  getKey(self, namespace, ns_key)
Get the key for a particular namespaced argument
str or the type of default getArg(self, namespace, key, default=None)
Get a value for a namespaced key.
dict getArgs(self, namespace)
Get the arguments that are defined for this namespace URI
  updateArgs(self, namespace, updates)
Set multiple key/value pairs in one call
  setArg(self, namespace, key, value)
Set a single argument in this namespace
  delArg(self, namespace, key)
  __str__(self)
str(x)
  __eq__(self, other)
  __ne__(self, other)
  getAliasedArg(self, aliased_key, default=None)

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__


Class Methods [hide private]
  fromPostArgs(cls, args)
Construct a Message containing a set of POST arguments
  fromOpenIDArgs(cls, openid_args)
Construct a Message from a parsed KVForm message
  fromKVForm(cls, kvform_string)
Create a Message from a KVForm string

Class Variables [hide private]
  allowed_openid_namespaces = ['http://openid.net/signon/1.0', 'http://specs.openi...
  namespaces
A dictionary specifying specific namespace-URI to alias mappings that should be used when generating namespace aliases.

Instance Variables [hide private]
  ns_args
two-level dictionary of the values in this message, grouped by namespace URI.

Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, openid_namespace=None)
(Constructor)

source code 

Create an empty Message
Overrides: object.__init__

fromPostArgs(cls, args)
Class Method

source code 

Construct a Message containing a set of POST arguments

fromOpenIDArgs(cls, openid_args)
Class Method

source code 

Construct a Message from a parsed KVForm message

setOpenIDNamespace(self, openid_ns_uri)

source code 

getOpenIDNamespace(self)

source code 

isOpenID1(self)

source code 

isOpenID2(self)

source code 

fromKVForm(cls, kvform_string)
Class Method

source code 

Create a Message from a KVForm string

copy(self)

source code 

toPostArgs(self)

source code 

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

toArgs(self)

source code 

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

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

source code 

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 (str) - The URL to which the form will be POSTed
  • form_tag_attrs ({unicode: unicode}) - 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.
  • submit_text (unicode) - The text that will appear on the submit button for this form.
Returns: str or unicode
A string containing (X)HTML markup for a form that encodes the values in this Message object.

toURL(self, base_url)

source code 

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

toKVForm(self)

source code 

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

toURLEncoded(self)

source code 

Generate an x-www-urlencoded string

hasKey(self, namespace, ns_key)

source code 

getKey(self, namespace, ns_key)

source code 

Get the key for a particular namespaced argument

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

source code 

Get a value for a namespaced key.
Parameters:
  • namespace (str) - The namespace in the message for this key
  • key (str) - The key to get within this namespace
  • 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)

source code 

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

updateArgs(self, namespace, updates)

source code 

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

setArg(self, namespace, key, value)

source code 

Set a single argument in this namespace

delArg(self, namespace, key)

source code 

__str__(self)
(Informal representation operator)

source code 

str(x)
Overrides: object.__str__
(inherited documentation)

__eq__(self, other)
(Equality operator)

source code 

__ne__(self, other)

source code 

getAliasedArg(self, aliased_key, default=None)

source code 

Class Variable Details [hide private]

allowed_openid_namespaces

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.

Instance Variable Details [hide private]

ns_args


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