def preset_cookie(request, token_string):
    """Create the cookie value for the token and save it on the request.

    The middleware will set the actual cookie (via `set_cookie`) on the
    response.

    """
    if token_string:
        request._auth_remember_token = token_string
    else:
        request._auth_remember_token = ''
