Exemplo n.º 1
0
    def download(self, request, pk=None):
        """
        Handles downloading of the Dataset.
        """
        dataset = self.get_object()

        return build_download_response(dataset.dataset_file)
Exemplo n.º 2
0
Arquivo: ajax.py Projeto: cfe-lab/Kive
    def download(self, request, pk=None):
        """
        Handles downloading of the Dataset.
        """
        dataset = self.get_object()

        return build_download_response(dataset.dataset_file)
Exemplo n.º 3
0
def stderr_download(request, methodoutput_id):
    """
    Display the standard output associated with the method output in the browser.
    """
    try:
        methodoutput = MethodOutput.objects.get(pk=methodoutput_id)
    except Dataset.DoesNotExist:
        raise Http404("Method output {} cannot be accessed".format(methodoutput_id))

    return build_download_response(methodoutput.error_log)
Exemplo n.º 4
0
def dataset_download(request, dataset_id):
    """
    Retrieve the file associated with the dataset for client download.
    """
    try:
        dataset = librarian.models.Dataset.filter_by_user(request.user).get(pk=dataset_id)
    except ObjectDoesNotExist:
        raise Http404("ID {} cannot be accessed".format(dataset_id))

    return build_download_response(dataset.dataset_file)
Exemplo n.º 5
0
def stderr_download(request, methodoutput_id):
    """
    Display the standard output associated with the method output in the browser.
    """
    try:
        methodoutput = MethodOutput.objects.get(pk=methodoutput_id)
    except Dataset.DoesNotExist:
        raise Http404(
            "Method output {} cannot be accessed".format(methodoutput_id))

    return build_download_response(methodoutput.error_log)
Exemplo n.º 6
0
Arquivo: ajax.py Projeto: cfe-lab/Kive
    def download(self, request, pk=None):
        """
        Handles downloading of the Dataset.
        """
        dataset = self.get_object()
        dataset_handle = dataset.get_open_file_handle()

        if dataset_handle is not None:
            return build_download_response(dataset_handle)
        else:
            raise APIException(f"Couldn't find dataset file for {dataset.name}")
Exemplo n.º 7
0
def dataset_download(request, dataset_id):
    """
    Retrieve the file associated with the dataset for client download.
    """
    try:
        dataset = librarian.models.Dataset.filter_by_user(
            request.user).get(pk=dataset_id)
    except ObjectDoesNotExist:
        raise Http404("ID {} cannot be accessed".format(dataset_id))

    return build_download_response(dataset.dataset_file)
Exemplo n.º 8
0
    def download(self, request, pk=None):
        """
        Download the file pointed to by this CodeResourceRevision.
        """
        accessible_revisions = CodeResourceRevision.filter_by_user(request.user)
        if not accessible_revisions.filter(pk=pk).exists():
            return Response(None, status=status.HTTP_404_NOT_FOUND)

        revision = self.get_object()
        if not revision.content_file:
            return Response({"errors": "This CodeResourceRevision has no content file."},
                            status=status.HTTP_403_FORBIDDEN)

        return build_download_response(revision.content_file)
Exemplo n.º 9
0
Arquivo: ajax.py Projeto: cfe-lab/Kive
 def download(self, request, pk=None):
     container = self.get_object()
     return build_download_response(container.file)
Exemplo n.º 10
0
Arquivo: ajax.py Projeto: cfe-lab/Kive
 def download(self, request, pk=None):
     container = self.get_object()
     return build_download_response(container.file)