def must_have_permission(permission):
    def wrapper(func):

        @functools.wraps(func)
        def wrapped(*args, **kwargs):
            # Ensure `project` and `node` kwargs
            _inject_nodes(kwargs)
            node = kwargs['node']

            kwargs['auth'] = Auth.from_kwargs(request.args.to_dict(), kwargs)
            user = kwargs['auth'].user

            # User must be logged in
            if user is None:
                raise HTTPError(http.UNAUTHORIZED)

            # User must have permissions
            if not node.has_permission(user, permission):
                raise HTTPError(http.FORBIDDEN)

            # Call view function
            return func(*args, **kwargs)

        # Return decorated function
        return wrapped

    # Return decorator
    return wrapper
A second call to wait() raises same value as the first call.
dataset/ETHPy150Open CenterForOpenScience/osf.io/website/project/decorators.py/must_have_permission--crossover with--dataset/ETHPy150Open itamarst/crochet/crochet/tests/test_api.py/EventualResultTests.test_failure_result_twice