def login_assistant(thisUser, password, request):
    """
    Shortcut function that will perform three things at once:

    #. Checks if the user exists
    #. Authenticates the user against a password using ``Auth.AuthManager.authenticate()``
    #. If authenticated, sets the appropriate session cookie (that is checked by ``get_current_user()`` and returns ``True``

    **Parameters**

    - ``thisUser`` - Mojo.Auth.models.User object
    - ``password`` - string password representation
    - ``request`` - RequestHandler object, does *not* require the Session Mixin to be used.

    **Usage:** ::

        from Mojo.Auth.Helpers import login_assitant

        thisUser = Users.find_one({'_id':ObjectId('504e0439a9ee2f04a0835a92'})

        if thisUser:
            is_authenticated = login_assistant(thisUser, password, self) #self in this case is a RequestHandler
            if is_authenticated:
                ...
            else:
                ...

    """
    logging.debug('Found user: %s' % thisUser)

    if thisUser is not None:
        # We now have a user, let's authenticate her
        is_authenticated = authenticate(thisUser, password)
        logging.debug(str(is_authenticated) % 'Checking is user is authenticated: %s')
        if is_authenticated:
            SessionManager(request)._login(thisUser)
            return True
        else:
            return False
    else:
        return False
dataset/ETHPy150Open lonelycode/Mojo/Mojo/Auth/Helpers.py/login_assistant/swapped operands of `%`