Example #1
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of pipeline instances for the queried pipeline.
     A document-level link relation, query list and a collection+json template are
     also added to the response.
     """
     queryset = self.get_pipeline_instances_queryset()
     response = services.get_list_response(self, queryset)
     pipeline = self.get_object()
     # append query list
     query_list = [
         reverse('pipelineinstance-list-query-search', request=request)
     ]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {
         'pipeline':
         reverse('pipeline-detail',
                 request=request,
                 kwargs={"pk": pipeline.id})
     }
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {
         'previous_plugin_inst_id': "",
         'title': "",
         'description': ""
     }
     param_names = pipeline.get_pipings_parameters_names()
     for name in param_names:
         template_data[name] = ""
     return services.append_collection_template(response, template_data)
Example #2
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append a collection+json write template.
     """
     response = services.get_list_response(self, [])
     template_data = {"username": "", "password": "", "email": ""}
     return services.append_collection_template(response, template_data)
Example #3
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list with all the plugin instances that are part of
     the queried pipeline instance.
     """
     queryset = self.get_plugin_instances_queryset()
     return services.get_list_response(self, queryset)
Example #4
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list with all the plugin instances that are part of
     the queried pipeline instance.
     """
     queryset = self.get_plugin_instances_queryset()
     return services.get_list_response(self, queryset)
Example #5
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the comments for the queried feed.
     A collection+json write template and document-level link relation are also
     added to the response.
     """
     queryset = self.get_comments_queryset()
     response = services.get_list_response(self, queryset)
     feed = self.get_object()
     # append query list
     query_list = [
         reverse('comment-list-query-search',
                 request=request,
                 kwargs={"pk": feed.id})
     ]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {
         'feed': reverse('feed-detail',
                         request=request,
                         kwargs={"pk": feed.id})
     }
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {"title": "", "content": ""}
     return services.append_collection_template(response, template_data)
Example #6
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of instances for the queried plugin.
     A collection+json template is also added to the response.
     """
     queryset = self.get_plugin_instances_queryset()
     response = services.get_list_response(self, queryset)
     plugin = self.get_object()
     # append query list
     query_list = [
         reverse('plugininstance-list-query-search', request=request)
     ]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {
         'plugin':
         reverse('plugin-detail', request=request, kwargs={"pk": plugin.id})
     }
     response = services.append_collection_links(response, links)
     # append write template
     param_names = plugin.get_plugin_parameter_names()
     template_data = {'previous_id': ""}
     for name in param_names:
         template_data[name] = ""
     return services.append_collection_template(response, template_data)
Example #7
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list with all the parameter values used by the queried
     plugin instance.
     """
     queryset = self.get_parameters_queryset()
     return services.get_list_response(self, queryset)
Example #8
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append a collection+json write template.
     """
     response = services.get_list_response(self, [])
     template_data = {"username": "", "password": "", "email": ""}
     return services.append_collection_template(response, template_data)
Example #9
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of instances for the queried plugin. A document-level
     link relation and a collection+json template are also added to the response.
     """
     queryset = self.get_plugin_instances_queryset()
     response = services.get_list_response(self, queryset)
     plugin = self.get_object()
     # append document-level link relations
     links = {
         'plugin':
         reverse('plugin-detail', request=request, kwargs={"pk": plugin.id})
     }
     response = services.append_collection_links(response, links)
     # append write template
     param_names = plugin.get_plugin_parameter_names()
     template_data = {
         'title': "",
         'previous_id': "",
         'cpu_limit': "",
         'memory_limit': "",
         'number_of_workers': "",
         'gpu_limit': ""
     }
     for name in param_names:
         template_data[name] = ""
     return services.append_collection_template(response, template_data)
Example #10
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list with all the default parameter values used by the
     queried pipeline.
     """
     queryset = self.get_default_parameters_queryset()
     response = services.get_list_response(self, queryset)
     return response
Example #11
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list with all the default parameter values used by the
     queried pipeline.
     """
     queryset = self.get_default_parameters_queryset()
     response = services.get_list_response(self, queryset)
     return response
Example #12
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the plugin instances for the queried feed.
     """
     queryset = self.get_plugin_instances_queryset()
     response = services.get_list_response(self, queryset)
     feed = self.get_object()
     links = {'feed': reverse('feed-detail', request=request, kwargs={"pk": feed.id})}
     return services.append_collection_links(response, links)
Example #13
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the plugin instances for the queried feed.
     """
     queryset = self.get_plugin_instances_queryset()
     response = services.get_list_response(self, queryset)
     feed = self.get_object()
     links = {'feed': reverse('feed-detail', request=request,
                                kwargs={"pk": feed.id})}
     return services.append_collection_links(response, links)
Example #14
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of favorite plugin metas for the queried user.
     """
     queryset = self.get_plugin_metas_queryset()
     response = services.get_list_response(self, queryset)
     user = self.get_object()
     links = {'user': reverse('user-detail', request=request,
                              kwargs={"pk": user.id})}
     return services.append_collection_links(response, links)
Example #15
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the plugins for the queried  meta.
     """
     queryset = self.get_plugins_queryset()
     response = services.get_list_response(self, queryset)
     meta = self.get_object()
     links = {'meta': reverse('pluginmeta-detail', request=request,
                              kwargs={"pk": meta.id})}
     return services.append_collection_links(response, links)
Example #16
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the files for the queried feed and
     append document-level link relations.
     """
     queryset = self.get_feedfiles_queryset()
     response = services.get_list_response(self, queryset)
     feed = self.get_object()
     links = {'feed': reverse('feed-detail', request=request, kwargs={"pk": feed.id})}
     return services.append_collection_links(response, links)
Example #17
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the plugin pipings for the queried pipeline.
     Document-level link relations are also added to the response.
     """
     queryset = self.get_plugin_pipings_queryset()
     response = services.get_list_response(self, queryset)
     pipeline = self.get_object()
     links = {'pipeline': reverse('pipeline-detail', request=request,
                                kwargs={"pk": pipeline.id})}
     return services.append_collection_links(response, links)
Example #18
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the feeds for the queried tag.
     Document-level link relations are also added to the response.
     """
     queryset = self.get_feeds_queryset()
     response = services.get_list_response(self, queryset)
     tag = self.get_object()
     links = {'tag': reverse('tag-detail', request=request,
                                kwargs={"pk": tag.id})}
     return services.append_collection_links(response, links)
Example #19
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the files for the queried feed and
     append document-level link relations.
     """
     queryset = self.get_feedfiles_queryset()
     response = services.get_list_response(self, queryset)
     feed = self.get_object()
     links = {'feed': reverse('feed-detail', request=request,
                                kwargs={"pk": feed.id})}
     return services.append_collection_links(response, links)
Example #20
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the plugin pipings for the queried pipeline.
     Document-level link relations are also added to the response.
     """
     queryset = self.get_plugin_pipings_queryset()
     response = services.get_list_response(self, queryset)
     pipeline = self.get_object()
     links = {'pipeline': reverse('pipeline-detail', request=request,
                                kwargs={"pk": pipeline.id})}
     return services.append_collection_links(response, links)
Example #21
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the feeds for the queried tag.
     Document-level link relations are also added to the response.
     """
     queryset = self.get_feeds_queryset()
     response = services.get_list_response(self, queryset)
     tag = self.get_object()
     links = {'tag': reverse('tag-detail', request=request,
                                kwargs={"pk": tag.id})}
     return services.append_collection_links(response, links)
Example #22
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of parameters for the queried plugin.
     A document-level link relation is also added to the response.
     """
     queryset = self.get_plugin_parameters_queryset()
     response = services.get_list_response(self, queryset)
     plugin = self.get_object()
     links = {'plugin': reverse('plugin-detail', request=request,
                                kwargs={"pk": plugin.id})}    
     return services.append_collection_links(response, links)
Example #23
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of parameters for the queried plugin.
     A document-level link relation is also added to the response.
     """
     queryset = self.get_plugin_parameters_queryset()
     response = services.get_list_response(self, queryset)
     plugin = self.get_object()
     links = {'plugin': reverse('plugin-detail', request=request,
                                kwargs={"pk": plugin.id})}
     return services.append_collection_links(response, links)
Example #24
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the tags for the queried feed that are
     owned by the currently authenticated user. Document-level link relations are
     also added to the response.
     """
     queryset = self.get_tags_queryset(request.user)
     response = services.get_list_response(self, queryset)
     feed = self.get_object()
     links = {'feed': reverse('feed-detail', request=request,
                                kwargs={"pk": feed.id})}
     return services.append_collection_links(response, links)
Example #25
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the tags for the queried feed that are
     owned by the currently authenticated user. Document-level link relations are
     also added to the response.
     """
     queryset = self.get_tags_queryset(request.user)
     response = services.get_list_response(self, queryset)
     feed = self.get_object()
     links = {'feed': reverse('feed-detail', request=request,
                                kwargs={"pk": feed.id})}
     return services.append_collection_links(response, links)
Example #26
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the comments for the queried feed.
     A collection+json template is also added to the response.
     """
     queryset = self.get_comments_queryset()
     response = services.get_list_response(self, queryset)
     feed = self.get_object()
     links = {'feed': reverse('feed-detail', request=request,
                                kwargs={"pk": feed.id})}
     response = services.append_collection_links(response, links)
     template_data = {"title": "", "content": ""}
     return services.append_collection_template(response, template_data)
Example #27
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list with all the parameter values used by the queried
     plugin instance.
     """
     queryset = self.get_parameters_queryset()
     response = services.get_list_response(self, queryset)
     results = response.data['results']
     # the items' url must be corrected because this view always uses the same string
     # serializer for any parameter type
     for item in results:
         item['url'] = item['url'].replace('string', item['type'])
     return response
Example #28
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the taggings for the queried tag.
     Document-level link relations and a collection+json template are also
     added to the response.
     """
     queryset = self.get_taggings_queryset()
     response = services.get_list_response(self, queryset)
     tag = self.get_object()
     links = {'tag': reverse('tag-detail', request=request,
                                kwargs={"pk": tag.id})}
     response = services.append_collection_links(response, links)
     template_data = {"feed_id": ""}
     return services.append_collection_template(response, template_data)
Example #29
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the files created by the queried plugin instance.
     """
     queryset = self.get_files_queryset()
     response = services.get_list_response(self, queryset)
     instance = self.get_object()
     feed = instance.get_root_instance().feed
     links = {
         'feed': reverse('feed-detail',
                         request=request,
                         kwargs={"pk": feed.id})
     }
     return services.append_collection_links(response, links)
Example #30
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the taggings for the queried tag.
     Document-level link relations and a collection+json template are also
     added to the response.
     """
     queryset = self.get_taggings_queryset()
     response = services.get_list_response(self, queryset)
     tag = self.get_object()
     links = {'tag': reverse('tag-detail', request=request,
                                kwargs={"pk": tag.id})}
     response = services.append_collection_links(response, links)
     template_data = {"feed_id": ""}
     return services.append_collection_template(response, template_data)
Example #31
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the files created by the queried plugin instance.
     Document-level link relations are also added to the response.
     """
     queryset = self.get_files_queryset()
     response = services.get_list_response(self, queryset)
     instance = self.get_object()
     feed = instance.feed
     links = {'feed': reverse('feed-detail', request=request,
                          kwargs={"pk": feed.id}),
              'plugin_inst': reverse('plugininstance-detail', request=request,
                                              kwargs={"pk": instance.id})}
     return services.append_collection_links(response, links)
Example #32
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations and a collection+json template
     to the response.
     """
     queryset = self.get_plugin_meta_collaborators_queryset()
     response = services.get_list_response(self, queryset)
     plg_meta = self.get_object()
     # append document-level link relations
     links = {'meta': reverse('pluginmeta-detail', request=request,
                              kwargs={"pk": plg_meta.id})}
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {'username': '', 'role': ''}
     return services.append_collection_template(response, template_data)
Example #33
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of splits for the queried plugin instance.
     A document-level link relation and a collection+json template are also added
     to the response.
     """
     queryset = self.get_splits_queryset()
     response = services.get_list_response(self, queryset)
     instance = self.get_object()
     # append document-level link relations
     links = {'plugin_inst': reverse('plugininstance-detail', request=request,
                                     kwargs={"pk": instance.id})}
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {'filter': '', 'compute_resource_name': ''}
     return services.append_collection_template(response, template_data)
 def test_get_list_response(self):
     """
     Test whether services.get_list_response() returns a response with two objects
     """
     # get response
     response = self.response
     # get the view and queryset
     view = response.renderer_context['view']
     queryset = view.get_queryset()
     list_response = services.get_list_response(view, queryset)
     # set required response attributes
     list_response.accepted_renderer = response.accepted_renderer
     list_response.accepted_media_type = response.accepted_media_type
     list_response.renderer_context = response.renderer_context
     self.assertContains(list_response, "bob")
     self.assertContains(list_response, "paul")
Example #35
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the comments for the queried feed.
     A collection+json template is also added to the response.
     """
     queryset = self.get_comments_queryset()
     response = services.get_list_response(self, queryset)
     feed = self.get_object()
     links = {
         'feed': reverse('feed-detail',
                         request=request,
                         kwargs={"pk": feed.id})
     }
     response = services.append_collection_links(response, links)
     template_data = {"title": "", "content": ""}
     return services.append_collection_template(response, template_data)
Example #36
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the tags for the queried
     feed that are owned by the currently authenticated user.
     A collection+json template is also added to the response.
     """
     queryset = self.get_tags_queryset(request.user)
     response = services.get_list_response(self, queryset)
     feed = self.get_object()
     links = {
         'feed': reverse('feed-detail',
                         request=request,
                         kwargs={"pk": feed.id})
     }
     response = services.append_collection_links(response, links)
     template_data = {"name": "", "color": ""}
     return services.append_collection_template(response, template_data)
Example #37
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of ingredients for the queried recipe.
     A document-level link relation and a collection+json template are also added
     to the response.
     """
     queryset = self.get_ingredients_queryset()
     response = services.get_list_response(self, queryset)
     recipe = self.get_object()
     # append document-level link relations
     links = {
         'recipe':
         reverse('recipe-detail', request=request, kwargs={"pk": recipe.id})
     }
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {'text': ""}
     return services.append_collection_template(response, template_data)
Example #38
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of pipeline instances for the queried pipeline.
     A document-level link relation, query list and a collection+json template are
     also added to the response.
     """
     queryset = self.get_pipeline_instances_queryset()
     response = services.get_list_response(self, queryset)
     pipeline = self.get_object()
     # append query list
     query_list = [reverse('pipelineinstance-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {'pipeline': reverse('pipeline-detail', request=request,
                                kwargs={"pk": pipeline.id})}
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {'previous_plugin_inst_id': "", 'title': "", 'description': ""}
     param_names = pipeline.get_pipings_parameters_names()
     for name in param_names:
         template_data[name] = ""
     return services.append_collection_template(response, template_data)
Example #39
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the plugin instance descendants.
     """
     queryset = self.get_descendants_queryset()
     return services.get_list_response(self, queryset)
Example #40
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of parameters for the queried plugin.
     """
     queryset = self.get_plugin_parameters_queryset()
     return services.get_list_response(self, queryset)