#NEWLINE# def set_user_cookie( response , user , remember = False ) : #NEWLINE# #INDENT# if auth_token : #NEWLINE# #INDENT# two_weeks = ( datetime . datetime . utcnow ( ) + datetime . timedelta ( days = 14 ) ) #NEWLINE# expires = two_weeks . strftime ( '%a, %d-%b-%y %H:%M:%S GMT' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# expires = None #NEWLINE# #UNINDENT# auth_token = generate_user_auth_token ( user . nick , user . password ) #NEWLINE# if ( settings . COOKIE_DOMAIN == 'localhost' ) : #NEWLINE# #INDENT# response . set_cookie ( settings . USER_COOKIE , user . nick , expires = expires , path = settings . COOKIE_PATH ) #NEWLINE# response . set_cookie ( settings . PASSWORD_COOKIE , auth_token , expires = expires , path = settings . COOKIE_PATH ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# response . set_cookie ( settings . USER_COOKIE , user . nick , expires = expires , path = settings . COOKIE_PATH , domain = settings . COOKIE_DOMAIN ) #NEWLINE# response . set_cookie ( settings . PASSWORD_COOKIE , auth_token , expires = expires , path = settings . COOKIE_PATH , domain = settings . COOKIE_DOMAIN ) #NEWLINE# #UNINDENT# return response