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

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

Class Methods
 
fromPostArgs(cls, args)
Construct a Message containing a set of POST arguments.
source code
 
fromOpenIDArgs(cls, openid_args)
Construct a Message from a parsed KVForm message.
source code
 
fromKVForm(cls, kvform_string)
Create a Message from a KVForm string
source code
Class Variables
  allowed_openid_namespaces = ['http://openid.net/signon/1.0', '...
  namespaces
A dictionary specifying specific namespace-URI to alias mappings that should be used when generating namespace aliases.
Instance Variables
  ns_args
two-level dictionary of the values in this message, grouped by namespace URI.
Properties

Inherited from object: __class__

Method Details

__init__(self, openid_namespace=None)
(Constructor)

source code 

Create an empty Message.

Raises:
Overrides: object.__init__

fromOpenIDArgs(cls, openid_args)
Class Method

source code 

Construct a Message from a parsed KVForm message.

Raises:

setOpenIDNamespace(self, openid_ns_uri, implicit)

source code 

Set the OpenID namespace URI used in this message.

Raises:

toPostArgs(self)

source code 

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

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.

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.

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

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

Class Variable Details

allowed_openid_namespaces

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

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.