Package yadis :: Module manager :: Class Discovery
[hide private]
[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 [hide private]
  __init__(self, session, url, session_key_suffix=None)
Initialize a discovery object
  getNextService(self, discover)
Return the next authentication service for the pair of user_input and session.
  cleanup(self)
Clean up Yadis-related services in the session and return the most-recently-attempted service from the manager, if one exists.
str getSessionKey(self)
Get the session key for this starting URL and suffix
  getManager(self)
Extract the YadisServiceManager for this object's URL and suffix from the session.
  createManager(self, services, yadis_url=None)
Create a new YadisService Manager for this starting URL and suffix, and store it in the session.
  destroyManager(self)
Delete any YadisServiceManager with this starting URL and suffix from the session.

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


Class Variables [hide private]
  DEFAULT_SUFFIX = 'auth'
  PREFIX = '_yadis_services_'

Instance Variables [hide private]
  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 [hide private]

Inherited from object: __class__


Method Details [hide private]

__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)

source code 

Clean up Yadis-related services in the session and return the most-recently-attempted service from the manager, if one exists.
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)

source code 

Extract the YadisServiceManager for this object's URL and suffix from the session.
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)

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.

Class Variable Details [hide private]

DEFAULT_SUFFIX

Value:
'auth'                                                                 
      

PREFIX

Value:
'_yadis_services_'                                                     
      

Instance Variable Details [hide private]

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