#NEWLINE# def get_current_user( self ) : #NEWLINE# #INDENT# "Loads user data from the DB if there's a user_id cookie defined.\n        \n        Resets the cookie if user is successfully loaded to prevent its expiration." #NEWLINE# user_id = self . get_secure_cookie ( 'user_id' ) #NEWLINE# if ( user_id != None ) : #NEWLINE# #INDENT# user = User . objects ( id = user_id ) . first ( ) #NEWLINE# if ( user != None ) : #NEWLINE# #INDENT# self . set_secure_cookie ( 'user_id' , user_id , expires_days = 365 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . clear_cookie ( 'user_id' ) #NEWLINE# #UNINDENT# return user #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return None