def get_current_user_for_models():
 user = get_current_user()
 try:
  if (not user.is_authenticated):
   return None
  return user
 except Exception as e:
  logger.info(('Cant access is_authenticated method: %s' % e))
  return None

def get_current_user_for_models ( ) : user = get_current_user ( ) try : if ( not user . is_authenticated ) : return None return user except Exception as e : logger . info ( ( 'Cant access is_authenticated method: %s' % e ) ) return None
hackish but needed for running tests outside application context because flask test context is not well configured yet :return: user or none .