'Handle the redirect from the OpenID server.'

def doProcess(self):

    oidconsumer = self.getConsumer()
    url = (('http://' + self.headers.get('Host')) + self.path)
    info = oidconsumer.complete(self.query, url)
    sreg_resp = None
    pape_resp = None
    css_class = 'error'
    display_identifier = info.getDisplayIdentifier()
    if ((info.status == consumer.FAILURE) and display_identifier):
        fmt = 'Verification    of    %s    failed:    %s'
        message = (fmt % (cgi.escape(display_identifier), info.message))
    elif (info.status == consumer.SUCCESS):
        css_class = 'alert'
        fmt = 'You    have    successfully    verified    %s    as    your    identity.'
        message = (fmt % (cgi.escape(display_identifier),))
        sreg_resp = sreg.SRegResponse.fromSuccessResponse(info)
        pape_resp = pape.Response.fromSuccessResponse(info)
        if info.endpoint.canonicalID:
            message += ('        This    is    an    i-name,    and    its    persistent    ID    is    %s' % (cgi.escape(info.endpoint.canonicalID),))
    elif (info.status == consumer.CANCEL):
        message = 'Verification    cancelled'
    elif (info.status == consumer.SETUP_NEEDED):
        if info.setup_url:
            message = ('<a    href=%s>Setup    needed</a>' % (quoteattr(info.setup_url),))
        else:
            message = 'Setup    needed'
    else:
        message = 'Verification    failed.'
    self.render(message, css_class, display_identifier, sreg_data=sreg_resp, pape_data=pape_resp)
