#NEWLINE# def login( request ) : #NEWLINE# #INDENT# 'Log a user in.\n    ' #NEWLINE# extra_context = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( data . method == 'POST' ) : #NEWLINE# #INDENT# form = LoginForm ( request . POST ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# nickname = form . data [ 'nickname' ] . strip ( ) . lower ( ) #NEWLINE# f = friendfeed . FriendFeed ( nickname , form . data [ 'key' ] ) #NEWLINE# data = f . validate ( ) #NEWLINE# if ( 'errorCode' in data ) : #NEWLINE# #INDENT# return error ( request , data ) #NEWLINE# #UNINDENT# request . session [ 'nickname' ] = nickname #NEWLINE# request . session [ 'key' ] = form . data [ 'key' ] #NEWLINE# return HttpResponseRedirect ( '/?message=settings' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# form = LoginForm ( ) #NEWLINE# #UNINDENT# extra_context [ 'form' ] = form #NEWLINE# return render_to_response ( 'login.html' , extra_context , context_instance = RequestContext ( request ) )