Package openid :: Package yadis :: Module manager :: Class Discovery
[frames | no frames]

Type Discovery

object --+
         |
        Discovery


State management for discovery.

High-level usage pattern is to call .getNextService(discover) in order to find the next available service for this user for this session. Once a request completes, call .finish() to clean up the session state.
Method Summary
  __init__(self, session, url, session_key_suffix)
Initialize a discovery object
  cleanup(self, force)
Clean up Yadis-related services in the session and return the most-recently-attempted service from the manager, if one exists.
  createManager(self, services, yadis_url)
Create a new YadisService Manager for this starting URL and suffix, and store it in the session.
  destroyManager(self, force)
Delete any YadisServiceManager with this starting URL and suffix from the session.
  getManager(self, force)
Extract the YadisServiceManager for this object's URL and suffix from the session.
  getNextService(self, discover)
Return the next authentication service for the pair of user_input and session.
str getSessionKey(self)
Get the session key for this starting URL and suffix
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Instance Variable Summary
  session: a dict-like object that stores state unique to the requesting user-agent.
  session_key_suffix: The suffix that will be used to identify this object in the session object.
  url: the URL that is used to make the discovery request

Class Variable Summary
str DEFAULT_SUFFIX = 'auth'
str PREFIX = '_yadis_services_'

Method Details

__init__(self, session, url, session_key_suffix=None)
(Constructor)

Initialize a discovery object
Overrides:
__builtin__.object.__init__

cleanup(self, force=False)

Clean up Yadis-related services in the session and return the most-recently-attempted service from the manager, if one exists.
Parameters:
force - True if the manager should be deleted regardless of whether it's a manager for self.url.
Returns:
current service endpoint object or None if there is no current service

createManager(self, services, yadis_url=None)

Create a new YadisService Manager for this starting URL and suffix, and store it in the session.
Returns:
A new YadisServiceManager or None
Raises:
KeyError - When I already have a manager.

destroyManager(self, force=False)

Delete any YadisServiceManager with this starting URL and suffix from the session.

If there is no service manager or the service manager is for a different URL, it silently does nothing.
Parameters:
force - True if the manager should be deleted regardless of whether it's a manager for self.url.

getManager(self, force=False)

Extract the YadisServiceManager for this object's URL and suffix from the session.
Parameters:
force - True if the manager should be returned regardless of whether it's a manager for self.url.
Returns:
The current YadisServiceManager, if it's for this URL, or else None

getNextService(self, discover)

Return the next authentication service for the pair of user_input and session. This function handles fallback.
Parameters:
discover - a callable that takes a URL and returns a list of services
           (type=str -> [service])
Returns:
the next available service

getSessionKey(self)

Get the session key for this starting URL and suffix
Returns:
The session key
           (type=str)

Instance Variable Details

session

a dict-like object that stores state unique to the requesting user-agent. This object must be able to store serializable objects.

session_key_suffix

The suffix that will be used to identify this object in the session object.

url

the URL that is used to make the discovery request

Class Variable Details

DEFAULT_SUFFIX

Type:
str
Value:
'auth'                                                                 

PREFIX

Type:
str
Value:
'_yadis_services_'                                                     

Generated by Epydoc 2.1 on Fri Jun 27 15:48:22 2008 http://epydoc.sf.net