(download_id, message=None, require_result=False)
return {
        'result': task_status.result,
        'error': task_status.error,
        'is_ready': is_ready,
        'is_alive': _is_alive(),
        'progress': task_status.progress._asdict(),
        'download_id': download_id,
        'allow_dropbox_sync': isinstance(download_data, FileDownload) and download_data.use_transfer,
        'has_file': download_data is not None and download_data.has_file,
        'custom_message': message,
    }
:param require_result: If set to True, is_ready will not be set to True unless result is
    also available. If check_state=False, this is ignored.
:param require_result: If set to True, is_ready will not be set to True unless result is
    also available. If check_state=False, this is ignored.
: param require_result : If set to True is_ready will not be set to True unless result is also available . If check_state = False this is ignored .
def get_download_context(download_id, message=None, require_result=False):
    """
    :param require_result: If set to True, is_ready will not be set to True unless result is
    also available. If check_state=False, this is ignored.
    """
    download_data = DownloadBase.get(download_id)
    if download_data is None:
        download_data = DownloadBase(download_id=download_id)

    task = download_data.task

    task_status = get_task_status(
        task, is_multiple_download_task=isinstance(download_data, MultipleTaskDownload))
    if task_status.failed():
        # Celery replaces exceptions with a wrapped one that we can't directly import
        # so I think our best choice is to match off the name, even though that's hacky
        exception_name = (task.result.__class__.__name__
                          if isinstance(task.result, Exception) else None)
        raise TaskFailedError([task_status.error], exception_name=exception_name)
    if require_result:
        is_ready = task_status.success() and task_status.result is not None
    else:
        is_ready = task_status.success()

    return {
        'result': task_status.result,
        'error': task_status.error,
        'is_ready': is_ready,
        'is_alive': _is_alive(),
        'progress': task_status.progress._asdict(),
        'download_id': download_id,
        'allow_dropbox_sync': isinstance(download_data, FileDownload) and download_data.use_transfer,
        'has_file': download_data is not None and download_data.has_file,
        'custom_message': message,
    }
def get_download_context ( download_id , message = None , require_result = False ) : download_data = DownloadBase . get ( download_id ) if download_data is None : download_data = DownloadBase ( download_id = download_id ) task = download_data . task task_status = get_task_status ( task , is_multiple_download_task = isinstance ( download_data , MultipleTaskDownload ) ) if task_status . failed ( ) : # Celery replaces exceptions with a wrapped one that we can't directly import # so I think our best choice is to match off the name, even though that's hacky exception_name = ( task . result . __class__ . __name__ if isinstance ( task . result , Exception ) else None ) raise TaskFailedError ( [ task_status . error ] , exception_name = exception_name ) if require_result : is_ready = task_status . success ( ) and task_status . result is not None else : is_ready = task_status . success ( ) return { 'result' : task_status . result , 'error' : task_status . error , 'is_ready' : is_ready , 'is_alive' : _is_alive ( ) , 'progress' : task_status . progress . _asdict ( ) , 'download_id' : download_id , 'allow_dropbox_sync' : isinstance ( download_data , FileDownload ) and download_data . use_transfer , 'has_file' : download_data is not None and download_data . has_file , 'custom_message' : message , }