Example #1
0
    def create(self, request):
        """Copy content."""
        serializer = CopySerializer(data=request.data, context={"request": request})
        serializer.is_valid(raise_exception=True)

        dependency_solving = serializer.validated_data["dependency_solving"]
        config = serializer.validated_data["config"]

        config, repos = self._process_config(config)

        async_result = enqueue_with_reservation(
            tasks.copy_content, repos, args=[config, dependency_solving], kwargs={}
        )
        return OperationPostponedResponse(async_result, request)
Example #2
0
    def create(self, request):
        """Copy content."""
        serializer = CopySerializer(data=request.data,
                                    context={'request': request})
        serializer.is_valid(raise_exception=True)

        source_repo = serializer.validated_data['source_repo']
        source_repo_version = serializer.validated_data['source_repo_version']
        dest_repo = serializer.validated_data['dest_repo']
        types = serializer.validated_data['types']

        async_result = enqueue_with_reservation(
            tasks.copy_content, [source_repo, dest_repo],
            args=[source_repo_version.pk, dest_repo.pk, types],
            kwargs={})
        return OperationPostponedResponse(async_result, request)