diff options
author | tailor <cygnus@cprogrammer.org> | 2007-11-19 19:59:02 +0000 |
---|---|---|
committer | tailor <cygnus@cprogrammer.org> | 2007-11-19 19:59:02 +0000 |
commit | 5dfadc9791d9580a141c77bc3a9f865df81f87df (patch) | |
tree | 2803927b7979dcab1ad3ab5dc267bf463b1f9aef /examples | |
parent | 15da5579e424d3fdb960be0f7b5e8387bb0c4e88 (diff) | |
download | openid-5dfadc9791d9580a141c77bc3a9f865df81f87df.tar.gz |
[project @ Update example consumer to show display_identifier]
Diffstat (limited to 'examples')
-rw-r--r-- | examples/consumer.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/examples/consumer.py b/examples/consumer.py index ff32639..cd9447f 100644 --- a/examples/consumer.py +++ b/examples/consumer.py @@ -230,12 +230,17 @@ class OpenIDRequestHandler(BaseHTTPRequestHandler): sreg_resp = None pape_resp = None css_class = 'error' - if info.status == consumer.FAILURE and info.identity_url: + + display_identifier = None + if info.endpoint is not None: + display_identifier = info.endpoint.getDisplayIdentifier() + + if info.status == consumer.FAILURE and display_identifier: # In the case of failure, if info is non-None, it is the # URL that we were verifying. We include it in the error # message to help the user figure out what happened. fmt = "Verification of %s failed: %s" - message = fmt % (cgi.escape(info.identity_url), + message = fmt % (cgi.escape(display_identifier), info.message) elif info.status == consumer.SUCCESS: # Success means that the transaction completed without @@ -247,7 +252,7 @@ class OpenIDRequestHandler(BaseHTTPRequestHandler): # was a real application, we would do our login, # comment posting, etc. here. fmt = "You have successfully verified %s as your identity." - message = fmt % (cgi.escape(info.identity_url),) + message = fmt % (cgi.escape(display_identifier),) sreg_resp = sreg.SRegResponse.fromSuccessResponse(info) pape_resp = pape.Response.fromSuccessResponse(info) if info.endpoint.canonicalID: @@ -275,8 +280,8 @@ class OpenIDRequestHandler(BaseHTTPRequestHandler): # information in a log. message = 'Verification failed.' - self.render(message, css_class, info.identity_url, sreg_data=sreg_resp, - pape_data=pape_resp) + self.render(message, css_class, display_identifier, + sreg_data=sreg_resp, pape_data=pape_resp) def doAffiliate(self): """Direct the user sign up with an affiliate OpenID provider.""" |