def download(self, request, pk=None): """ Handles downloading of the Dataset. """ dataset = self.get_object() return build_download_response(dataset.dataset_file)
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)
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)
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)
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}")
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)
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)
def download(self, request, pk=None): container = self.get_object() return build_download_response(container.file)