Пример #1
0
    def get_object(self):
        """
        Retrieve current information about a task.
        """
        task_id = self.kwargs['task_id']
        initial_dict = get_task(self.request.session, task_id)
        if initial_dict is None:
            raise Http404

        return create_task_result_dict(initial_dict)
Пример #2
0
    def get_object(self):
        """
        Retrieve current information about an export task.
        """
        task_id = self.kwargs['task_id']
        initial_dict = get_task(self.request.session, task_id)
        if initial_dict is None:
            raise Http404

        result = create_task_result_dict(initial_dict)
        return {
            "id": result['id'],
            "status": result['status'],
            "url": result['result']['url'],
            "collision": result['result']['collision']
        }
Пример #3
0
    def get_queryset(self):
        """Get export tasks for this user."""
        repo_slug = self.kwargs['repo_slug']
        export_tasks = [
            task for task in get_tasks(self.request.session).values()
            if task['task_type'] == EXPORT_TASK_TYPE and
            task['task_info']['repo_slug'] == repo_slug
        ]

        task_results = [create_task_result_dict(task) for task in export_tasks]

        return [
            {
                "id": result['id'],
                "status": result['status'],
                "url": result['result']['url'],
                "collision": result['result']['collision']
            } for result in task_results
        ]
Пример #4
0
    def get_queryset(self):
        """Get tasks for this user."""
        tasks = get_tasks(self.request.session)

        return [create_task_result_dict(task) for task in tasks.values()]