diff --git a/lib/galaxy/config.py b/lib/galaxy/config.py index 543a6aa60b7..bcd5c631588 100644 --- a/lib/galaxy/config.py +++ b/lib/galaxy/config.py @@ -233,6 +233,11 @@ class Configuration( object ): self.amqp[k] = v self.biostar = kwargs.get( 'biostar', None ) self.running_functional_tests = string_as_bool( kwargs.get( 'running_functional_tests', False ) ) + # Experimental: This will not be enabled by default and will hide + # nonproduction code. + # The api_folders refers to whether the API exposes + self.api_folders = string_as_bool( kwargs.get( 'api_folders', False ) ) + def __read_tool_job_config( self, global_conf_parser, section, key ): try: tool_runners_config = global_conf_parser.items( section ) diff --git a/lib/galaxy/webapps/galaxy/api/libraries.py b/lib/galaxy/webapps/galaxy/api/libraries.py index 98208efaf74..20dfd1755c8 100644 --- a/lib/galaxy/webapps/galaxy/api/libraries.py +++ b/lib/galaxy/webapps/galaxy/api/libraries.py @@ -20,6 +20,7 @@ class LibrariesController( BaseAPIController ): GET /api/libraries/deleted Displays a collection (list) of libraries. """ + log.debug( "LibrariesController.index: enter" ) query = trans.sa_session.query( trans.app.model.Library ) deleted = util.string_as_bool( deleted ) if deleted: @@ -53,6 +54,7 @@ class LibrariesController( BaseAPIController ): GET /api/libraries/deleted/{encoded_library_id} Displays information about a library. """ + log.debug( "LibraryContentsController.show: enter" ) library_id = id deleted = util.string_as_bool( deleted ) params = util.Params( kwd ) diff --git a/lib/galaxy/webapps/galaxy/api/library_contents.py b/lib/galaxy/webapps/galaxy/api/library_contents.py index b493d34e190..f63d5195d30 100644 --- a/lib/galaxy/webapps/galaxy/api/library_contents.py +++ b/lib/galaxy/webapps/galaxy/api/library_contents.py @@ -13,6 +13,7 @@ log = logging.getLogger( __name__ ) class LibraryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibraryMixinItems ): @web.expose_api + # TODO: Add parameter to only get top level of datasets/subfolders. def index( self, trans, library_id, **kwd ): """ GET /api/libraries/{encoded_library_id}/contents diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index c409d3e2fce..d645a8c2987 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -60,6 +60,10 @@ def app_factory( global_conf, **kwargs ): # Add the web API webapp.add_api_controllers( 'galaxy.webapps.galaxy.api', app ) + # The /folders section is experimental at this point: + log.debug( "app.config.api_folders: %s" % app.config.api_folders ) + if app.config.api_folders: + webapp.api_mapper.resource( 'folder', 'folders', path_prefix='/api' ) webapp.api_mapper.resource( 'content', 'contents', controller='library_contents', diff --git a/lib/galaxy/webapps/galaxy/controllers/library_common.py b/lib/galaxy/webapps/galaxy/controllers/library_common.py index 19fc68632c2..e5d2a3e0464 100644 --- a/lib/galaxy/webapps/galaxy/controllers/library_common.py +++ b/lib/galaxy/webapps/galaxy/controllers/library_common.py @@ -317,6 +317,8 @@ class LibraryCommon( BaseUIController, UsesFormDefinitionsMixin ): status='done' ) # If not inheritable info_association, redirect to the library. message = "The new folder named '%s' has been added to the data library." % new_folder.name + # SM: This is the second place where the API controller would + # reference the library id: return trans.response.send_redirect( web.url_for( controller='library_common', action='browse_library', cntrller=cntrller, diff --git a/scripts/api/library_create_folder.py b/scripts/api/library_create_folder.py index f23fd41ca48..75918b18c37 100755 --- a/scripts/api/library_create_folder.py +++ b/scripts/api/library_create_folder.py @@ -15,6 +15,7 @@ except IndexError: try: data[ 'description' ] = sys.argv[5] except IndexError: + print "Unable to set description; using empty description in its place" data[ 'description' ] = '' submit( sys.argv[1], sys.argv[2], data )