#NEWLINE# def oauth_login( request , service , redirect_field_name = 'next' , redirect_to_session_key = 'redirect_to' ) : #NEWLINE# #INDENT# access = OAuthAccess ( service ) #NEWLINE# if ( not ( service == 'facebook' ) ) : #NEWLINE# #INDENT# token = access . unauthorized_token ( ) #NEWLINE# request . session [ ( '%s_unauth_token' % service ) ] = token . to_string ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# token = None #NEWLINE# #UNINDENT# if hasattr ( request , 'session' ) : #NEWLINE# #INDENT# request . session [ redirect_to_session_key ] = request . GET . get ( redirect_field_name ) #NEWLINE# #UNINDENT# return HttpResponseRedirect ( access . authorization_url ( token ) )