#NEWLINE# def get_user_by_session( self , save_session = True ) : #NEWLINE# #INDENT# 'Returns a user based on the current session.\n\n        :param save_session:\n            If True, saves the user in the session if authentication succeeds.\n        :returns:\n            A user dict or None.\n        ' #NEWLINE# if ( self . _user is None ) : #NEWLINE# #INDENT# data = self . get_session_data ( pop = True ) #NEWLINE# if ( not data ) : #NEWLINE# #INDENT# self . _user = _anon #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _user = self . get_user_by_token ( user_id = data [ 'user_id' ] , token = data [ 'token' ] , token_ts = data [ 'token_ts' ] , cache = data , cache_ts = data [ 'cache_ts' ] , remember = data [ 'remember' ] , save_session = save_session ) #NEWLINE# #UNINDENT# #UNINDENT# return self . _user_or_none ( )