def _negotiateAssociation(self, endpoint):
        """Make association requests to the server, attempting to
        create a new association.

        @returns: a new association object

        @rtype: L{openid.association.Association}
        """
        # Get our preferred session/association type from the negotiatior.
        assoc_type, session_type = self.negotiator.getAllowedType()

        try:
            assoc = self._requestAssociation(endpoint, assoc_type,
                                             session_type)
        except ServerError as why:
            supportedTypes = self._extractSupportedAssociationType(
                why, endpoint, assoc_type)
            if supportedTypes is not None:
                assoc_type, session_type = supportedTypes
                # Attempt to create an association from the assoc_type
                # and session_type that the server told us it
                # supported.
                try:
                    assoc = self._requestAssociation(endpoint, assoc_type,
                                                     session_type)
                except ServerError as why:
                    # Do not keep trying, since it rejected the
                    # association type that it told us to use.
                    logging.error(
                        'Server %s refused its suggested association '
                        'type: session_type=%s, assoc_type=%s' % (
                            endpoint.server_url, session_type, assoc_type))
                    return None
                else:
                    return assoc
        else:
            return assoc
def _negotiateAssociation ( self , endpoint ) : assoc_type , session_type = self . negotiator . getAllowedType ( ) try : assoc = self . _requestAssociation ( endpoint , assoc_type , session_type ) except ServerError as why : supportedTypes = self . _extractSupportedAssociationType ( why , endpoint , assoc_type ) if supportedTypes is not None : assoc_type , session_type = supportedTypes try : assoc = self . _requestAssociation ( endpoint , assoc_type , session_type ) except ServerError as why : logging . error ( 'Server %s refused its suggested association ' 'type: session_type=%s, assoc_type=%s' % ( endpoint . server_url , session_type , assoc_type ) ) return None else : return assoc else : return assoc
Make association requests to the server, attempting to
        create a new association.

        @returns: a new association object

        @rtype: L{openid.association.Association}