From ec72618592e9998d17f218d433600d63d1e175de Mon Sep 17 00:00:00 2001 From: John Chilton Date: Mon, 12 May 2014 09:54:02 -0500 Subject: [PATCH] Small improvements to collection creation API. Return full collection when creating collection and improved error handling during creation. --- lib/galaxy/dataset_collections/__init__.py | 4 ++++ lib/galaxy/webapps/galaxy/api/history_contents.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/dataset_collections/__init__.py b/lib/galaxy/dataset_collections/__init__.py index fb6624a876b..a42180bd288 100644 --- a/lib/galaxy/dataset_collections/__init__.py +++ b/lib/galaxy/dataset_collections/__init__.py @@ -202,6 +202,10 @@ class DatasetCollectionsService( def __load_elements( self, trans, element_identifiers ): elements = odict.odict() for element_identifier in element_identifiers: + if "name" not in element_identifier: + raise RequestParameterInvalidException( + "Cannot load invalid dataset identifier - missing name - %s" % element_identifier + ) elements[ element_identifier[ "name" ] ] = self.__load_element( trans, element_identifier ) return elements diff --git a/lib/galaxy/webapps/galaxy/api/history_contents.py b/lib/galaxy/webapps/galaxy/api/history_contents.py index a550376a383..d1d90d2badb 100644 --- a/lib/galaxy/webapps/galaxy/api/history_contents.py +++ b/lib/galaxy/webapps/galaxy/api/history_contents.py @@ -295,7 +295,7 @@ class HistoryContentsController( BaseAPIController, UsesHistoryDatasetAssociatio create_params = api_payload_to_create_params( payload ) service = trans.app.dataset_collections_service dataset_collection_instance = service.create( trans, parent=history, **create_params ) - return self.__collection_dict( trans, dataset_collection_instance ) + return self.__collection_dict( trans, dataset_collection_instance, view="element" ) @expose_api_anonymous def update( self, trans, history_id, id, payload, **kwd ):