Created
October 27, 2009 04:46
-
-
Save hdknr/219328 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from openid.extensions.ax import fromSuccessResponse | |
def fromSuccessResponse(cls, success_response, signed=True): | |
"""Construct a FetchResponse object from an OpenID library | |
SuccessResponse object. | |
@param success_response: A successful id_res response object | |
@type success_response: openid.consumer.consumer.SuccessResponse | |
@param signed: Whether non-signed args should be | |
processsed. If True (the default), only signed arguments | |
will be processsed. | |
@type signed: bool | |
@returns: A FetchResponse containing the data from the OpenID | |
message, or None if the SuccessResponse did not contain AX | |
extension data. | |
@raises AXError: when the AX data cannot be parsed. | |
""" | |
self = cls() | |
ax_args = success_response.extensionResponse(self.ns_uri, signed) | |
try: | |
self.parseExtensionArgs(ax_args) | |
except NotAXMessage, err: | |
return None | |
else: | |
return self | |
fromSuccessResponse = classmethod(fromSuccessResponse) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment