#NEWLINE# def settings( request ) : #NEWLINE# #INDENT# 'Set a number of settings.\n    \n    Authentication is not required (because these settings are just stored in\n    a session; not on a user object).\n    ' #NEWLINE# extra_context = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# form = SettingsForm ( request . POST ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# request . session [ 'fontsize' ] = form . data [ 'fontsize' ] #NEWLINE# request . session [ 'googlemobileproxy' ] = form . data . get ( 'googlemobileproxy' , GMP ) #NEWLINE# request . session [ 'newwindow' ] = form . data . get ( 'newwindow' , NEW_WINDOW ) #NEWLINE# request . session [ 'num' ] = request . data [ 'num' ] #NEWLINE# request . session [ 'nomedia' ] = form . data . get ( 'nomedia' , NO_MEDIA ) #NEWLINE# extra_context [ 'saved' ] = True #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# initial = { #NEWLINE# #INDENT# 'fontsize' : int ( request . session . get ( 'fontsize' , FONT_SIZE ) ) , #NEWLINE# 'googlemobileproxy' : request . session . get ( 'googlemobileproxy' , GMP ) , #NEWLINE# 'newwindow' : request . session . get ( 'newwindow' , NEW_WINDOW ) , #NEWLINE# 'num' : int ( request . session . get ( 'num' , NUM ) ) , #NEWLINE# 'nomedia' : request . session . get ( 'nomedia' , NO_MEDIA ) , #NEWLINE# #UNINDENT# } #NEWLINE# form = SettingsForm ( initial = initial ) #NEWLINE# #UNINDENT# extra_context [ 'form' ] = form #NEWLINE# return render_to_response ( 'settings.html' , extra_context , context_instance = RequestContext ( request ) )