#NEWLINE# @ mediator . authorize #NEWLINE# def authorize( request , access_token , redirect_to = settings . LOGIN_REDIRECT_URL ) : #NEWLINE# #INDENT# ( service , created ) = FoursquareService . objects . get_or_create ( user = request . user , defaults = { #NEWLINE# #INDENT# 'token' : access_token [ 'oauth_token' ] , #NEWLINE# 'secret' : access_token [ 'oauth_token_secret' ] , #NEWLINE# 'unique_id' : helper . get_unique_id ( access_token ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# if created : #NEWLINE# #INDENT# message = 'Foursquare account added.' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# message = 'This Foursquare account has already been adeed.' #NEWLINE# #UNINDENT# request . user . message_set . create ( message = message ) #NEWLINE# return HttpResponseRedirect ( redirect_to )