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

Class Discovery

source code

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.

Instance Methods
 
__init__(self, session, url, session_key_suffix=None)
Initialize a discovery object
source code
 
getNextService(self, discover)
Return the next authentication service for the pair of user_input and session.
source code
 
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.
source code
str
getSessionKey(self)
Get the session key for this starting URL and suffix
source code
 
getManager(self, force=False)
Extract the YadisServiceManager for this object's URL and suffix from the session.
source code
 
createManager(self, services, yadis_url=None)
Create a new YadisService Manager for this starting URL and suffix, and store it in the session.
source code
 
destroyManager(self, force=False)
Delete any YadisServiceManager with this starting URL and suffix from the session.
source code

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

Class Variables
  DEFAULT_SUFFIX = 'auth'
  PREFIX = '_yadis_services_'
Instance Variables
  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
Properties

Inherited from object: __class__

Method Details

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

source code 

Initialize a discovery object

Overrides: object.__init__

getNextService(self, discover)

source code 

Return the next authentication service for the pair of user_input and session. This function handles fallback.

Parameters:
  • discover (str -> [service]) - a callable that takes a URL and returns a list of services
Returns:
the next available service

cleanup(self, force=False)

source code 

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

getSessionKey(self)

source code 

Get the session key for this starting URL and suffix

Returns: str
The session key

getManager(self, force=False)

source code 

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

createManager(self, services, yadis_url=None)

source code 

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)

source code 

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.

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.