Skip to content

Commit 5cd9b07

Browse files
author
tailor
committed
[project @ Fix simple registration API to use toMessage()]
1 parent a0de22d commit 5cd9b07

2 files changed

Lines changed: 8 additions & 15 deletions

File tree

‎examples/server.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def approved(self, request, identifier=None):
206206

207207
sreg_resp = sreg.SRegResponse.extractResponse(sreg_req, sreg_data)
208208
response = request.answer(True, identity=identifier)
209-
sreg_resp.addToOpenIDResponse(response.fields)
209+
sreg_resp.toMessage(response.fields)
210210

211211
return response
212212

‎openid/sreg.py‎

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# [ get the user's approval and data, informing the user that
2020
# the fields in sreg_response were requested ]
2121
sreg_resp = SRegResponse.extractResponse(sreg_req, user_data)
22-
sreg_resp.addToOpenIDResponse(openid_response)
22+
sreg_resp.toMessage(openid_response.fields)
2323
2424
3. The relying party uses C{L{SRegResponse.fromSuccessResponse}} to
2525
extract the data from the OpenID response::
@@ -383,7 +383,7 @@ class SRegResponse(Extension):
383383
@ivar ns_uri: The URI under which the simple registration data was
384384
stored in the response message.
385385
386-
@group Server: extractResponse, addToOpenIDResponse
386+
@group Server: extractResponse
387387
@group Consumer: fromSuccessResponse
388388
@group Read-only dictionary interface: keys, iterkeys, items, iteritems,
389389
__iter__, get, __getitem__, keys, has_key
@@ -463,18 +463,11 @@ def fromSuccessResponse(cls, success_response, signed_only=True):
463463

464464
fromSuccessResponse = classmethod(fromSuccessResponse)
465465

466-
def addToOpenIDResponse(self, response_message):
467-
"""Add the data fields contained in this simple registration
468-
response to the supplied message, in the appropriate
469-
namespace.
470-
471-
@param response_message: The OpenID id_res response message
472-
that will be returned to the relying party
473-
@type response_message: C{L{openid.message.Message}}
474-
475-
@returns: Nothing; updates the response_message
466+
def getExtensionArgs(self):
467+
"""
468+
Return the sreg data to be sent in the response.
476469
"""
477-
response_message.updateArgs(self.ns_uri, self.data)
470+
return self.data
478471

479472
# Read-only dictionary interface
480473
def get(self, field_name, default=None):
@@ -533,4 +526,4 @@ def sendSRegFields(openid_request, data, openid_response):
533526
"""
534527
sreg_request = SRegRequest.fromOpenIDRequest(openid_request.message)
535528
sreg_response = SRegResponse.extractResponse(sreg_request, data)
536-
sreg_response.addToOpenIDResponse(openid_response.fields)
529+
sreg_response.toMessage(openid_response.fields)

0 commit comments

Comments
 (0)