def endpoint(request):
 s = getServer(request)
 query = util.normalDict((request.GET or request.POST))
 try:
  openid_request = s.decodeRequest(query)
 except ProtocolError as why:
  return direct_to_template(request, 'server/endpoint.html', {'error': str(why)})
 if (openid_request is None):
  return direct_to_template(request, 'server/endpoint.html', {})
 if (openid_request.mode in ['checkid_immediate', 'checkid_setup']):
  return handleCheckIDRequest(request, openid_request)
 else:
  openid_response = s.handleRequest(openid_request)
  return displayResponse(request, openid_response)

def endpoint ( request ) : s = getServer ( request ) query = util . normalDict ( ( request . GET or request . POST ) ) try : openid_request = s . decodeRequest ( query ) except ProtocolError as why : return direct_to_template ( request , 'server/endpoint.html' , { 'error' : str ( why ) } ) if ( openid_request is None ) : return direct_to_template ( request , 'server/endpoint.html' , { } ) if ( openid_request . mode in [ 'checkid_immediate' , 'checkid_setup' ] ) : return handleCheckIDRequest ( request , openid_request ) else : openid_response = s . handleRequest ( openid_request ) return displayResponse ( request , openid_response )
respond to low-level openid protocol messages .