Package openid :: Package extensions :: Module sreg :: Class SRegResponse
[hide private]
[frames] | no frames]

Class SRegResponse

source code

         object --+    
                  |    
extension.Extension --+
                      |
                     SRegResponse

Represents the data returned in a simple registration response inside of an OpenID id_res response. This object will be created by the OpenID server, added to the id_res response object, and then extracted from the id_res message by the Consumer.

Instance Methods [hide private]
 
__init__(self, data=None, sreg_ns_uri='http://openid.net/extensions/sreg/1.1')
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
getExtensionArgs(self)
Get the fields to put in the simple registration namespace when adding them to an id_res message.
source code
 
__contains__(self, field_name) source code
 
__nonzero__(self) source code

Inherited from extension.Extension: toMessage

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

    Read-only dictionary interface
 
get(self, field_name, default=None)
Like dict.get, except that it checks that the field name is defined by the simple registration specification
source code
 
items(self)
All of the data values in this simple registration response
source code
 
iteritems(self) source code
 
keys(self) source code
 
iterkeys(self) source code
 
has_key(self, key) source code
 
__iter__(self) source code
 
__getitem__(self, field_name) source code
Class Methods [hide private]
    Server
SRegResponse
extractResponse(cls, request, data)
Take a SRegRequest and a dictionary of simple registration values and create a SRegResponse object containing that data.
source code
    Consumer
SRegResponse
fromSuccessResponse(cls, success_response, signed_only=True)
Create a SRegResponse object from a successful OpenID library response (openid.consumer.consumer.SuccessResponse) response message
source code
Static Methods [hide private]
str
_getSRegNS(message)
Extract the simple registration namespace URI from the given OpenID message.
source code
Class Variables [hide private]
  ns_alias = 'sreg'
Instance Variables [hide private]
  data
The simple registration data, keyed by the unqualified simple registration name of the field (i.e.
  ns_uri
The namespace to which to add the arguments for this extension
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, data=None, sreg_ns_uri='http://openid.net/extensions/sreg/1.1')
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

extractResponse(cls, request, data)
Class Method

source code 

Take a SRegRequest and a dictionary of simple registration values and create a SRegResponse object containing that data.

Parameters:
  • request (SRegRequest) - The simple registration request object
  • data ({str:str}) - The simple registration data for this response, as a dictionary from unqualified simple registration field name to string (unicode) value. For instance, the nickname should be stored under the key 'nickname'.
Returns: SRegResponse
a simple registration response object

_getSRegNS(message)
Static Method

source code 

Extract the simple registration namespace URI from the given OpenID message. Handles OpenID 1 and 2, as well as both sreg namespace URIs found in the wild, as well as missing namespace definitions (for OpenID 1)

Parameters:
  • message (openid.message.Message) - The OpenID message from which to parse simple registration fields. This may be a request or response message.
Returns: str
the sreg namespace URI for the supplied message. The message may be modified to define a simple registration namespace.
Raises:
  • ValueError - when using OpenID 1 if the message defines the 'sreg' alias to be something other than a simple registration type.

fromSuccessResponse(cls, success_response, signed_only=True)
Class Method

source code 

Create a SRegResponse object from a successful OpenID library response (openid.consumer.consumer.SuccessResponse) response message

Parameters:
  • success_response (openid.consumer.consumer.SuccessResponse) - A SuccessResponse from consumer.complete()
  • signed_only (bool) - Whether to process only data that was signed in the id_res message from the server.
Returns: SRegResponse
A simple registration response containing the data that was supplied with the id_res response.

getExtensionArgs(self)

source code 

Get the fields to put in the simple registration namespace when adding them to an id_res message.

Returns:
A dictionary of completely non-namespaced arguments to be added. For example, if the extension's alias is 'uncle', and this method returns {'meat':'Hot Rats'}, the final message will contain {'openid.uncle.meat':'Hot Rats'}
Overrides: extension.Extension.getExtensionArgs

See Also: openid.extension


Instance Variable Details [hide private]

data

The simple registration data, keyed by the unqualified simple registration name of the field (i.e. nickname is keyed by 'nickname')