Package openid :: Package extensions :: Module sreg :: Class SRegRequest
[frames | no frames]

Type SRegRequest

object --+    
         |    
 Extension --+
             |
            SRegRequest


An object to hold the state of a simple registration request.
Method Summary
  __init__(self, required, optional, policy_url, sreg_ns_uri)
Initialize an empty simple registration request
  __contains__(self, field_name)
Was this field in the request?
[str] allRequestedFields(self)
A list of all of the simple registration fields that were requested, whether they were required or optional.
bool wereFieldsRequested(self)
Have any simple registration fields been requested?
Inherited from Extension: toMessage
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__
    Consumer
  requestField(self, field_name, required, strict)
Request the specified field from the OpenID user
  requestFields(self, field_names, required, strict)
Add the given list of fields to the request
{str:str} getExtensionArgs(self)
Get a dictionary of unqualified simple registration arguments representing this request.
    Server
SRegRequest fromOpenIDRequest(cls, request)
Create a simple registration request that contains the fields that were requested in the OpenID request with the given arguments (Class method)
  parseExtensionArgs(self, args, strict)
Parse the unqualified simple registration request parameters and add them to this object.

Instance Variable Summary
[str] optional: A list of the optional fields in this simple registration request
str or NoneType policy_url: The policy URL that was provided with the request
[str] required: A list of the required fields in this simple registration request
Inherited from Extension: ns_uri

Class Variable Summary
str ns_alias = 'sreg'

Instance Method Details

requestField(self, field_name, required=False, strict=False)

Request the specified field from the OpenID user
Parameters:
field_name - the unqualified simple registration field name
           (type=str)
required - whether the given field should be presented to the user as being a required to successfully complete the request
strict - whether to raise an exception when a field is added to a request more than once
Raises:
ValueError - when the field requested is not a simple registration field or strict is set and the field was requested more than once

requestFields(self, field_names, required=False, strict=False)

Add the given list of fields to the request
Parameters:
field_names - The simple registration data fields to request
           (type=[str])
required - Whether these values should be presented to the user as required
strict - whether to raise an exception when a field is added to a request more than once
Raises:
ValueError - when a field requested is not a simple registration field or strict is set and a field was requested more than once

getExtensionArgs(self)

Get a dictionary of unqualified simple registration arguments representing this request.

This method is essentially the inverse of parseExtensionArgs. This method serializes the simple registration request fields.
Returns:
{str:str}
Overrides:
openid.extension.Extension.getExtensionArgs

parseExtensionArgs(self, args, strict=False)

Parse the unqualified simple registration request parameters and add them to this object.

This method is essentially the inverse of getExtensionArgs. This method restores the serialized simple registration request fields.

If you are extracting arguments from a standard OpenID checkid_* request, you probably want to use fromOpenIDRequest, which will extract the sreg namespace and arguments from the OpenID request. This method is intended for cases where the OpenID server needs more control over how the arguments are parsed than that method provides.
>>> args = message.getArgs(ns_uri)
>>> request.parseExtensionArgs(args)
Parameters:
args - The unqualified simple registration arguments
           (type={str:str})
strict - Whether requests with fields that are not defined in the simple registration specification should be tolerated (and ignored)
           (type=bool)
Returns:
None; updates this object

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

Initialize an empty simple registration request
Overrides:
__builtin__.object.__init__

__contains__(self, field_name)
(In operator)

Was this field in the request?

allRequestedFields(self)

A list of all of the simple registration fields that were requested, whether they were required or optional.
Returns:
[str]

wereFieldsRequested(self)

Have any simple registration fields been requested?
Returns:
bool

Class Method Details

fromOpenIDRequest(cls, request)

Create a simple registration request that contains the fields that were requested in the OpenID request with the given arguments
Parameters:
request - The OpenID request
           (type=openid.server.CheckIDRequest)
Returns:
The newly created simple registration request
           (type=SRegRequest)

Instance Variable Details

optional

A list of the optional fields in this simple registration request
Type:
[str]

policy_url

The policy URL that was provided with the request
Type:
str or NoneType

required

A list of the required fields in this simple registration request
Type:
[str]

Class Variable Details

ns_alias

Type:
str
Value:
'sreg'                                                                 

Generated by Epydoc 2.1 on Fri Jun 6 15:54:34 2008 http://epydoc.sf.net