2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/394f11c09707/ Changeset: 394f11c09707 User: martenson Date: 2015-02-09 21:29:31+00:00 Summary: minor adjustments to toolshed search Affected #: 2 files diff -r 54a0ae599d9c3bf40f57d86e12360ef74118dadb -r 394f11c097071738b81cec7e86080e53e697a151 lib/galaxy/webapps/tool_shed/api/search.py --- a/lib/galaxy/webapps/tool_shed/api/search.py +++ b/lib/galaxy/webapps/tool_shed/api/search.py @@ -22,19 +22,32 @@ The index has to be pre-created with build_ts_whoosh_index.sh. TS config option toolshed_search_on has to be turned on and toolshed_whoosh_index_dir has to be specified and existing. + + :param search_term: + :param page: + :param jsonp: + :param callback: + + :returns dict: """ if not self.app.config.toolshed_search_on: raise exceptions.ConfigDoesNotAllowException( 'Searching the TS through the API is turned off for this instance.' ) if not self.app.config.toolshed_whoosh_index_dir: raise exceptions.ConfigDoesNotAllowException( 'There is no directory for the search index specified. Please ontact the administrator.' ) + search_term = search_term.strip() if len( search_term ) < 3: raise exceptions.RequestParameterInvalidException( 'The search term has to be at least 3 characters long.' ) page = kwd.get( 'page', 1 ) + return_jsonp = kwd.get( 'jsonp', False ) callback = kwd.get( 'callback', 'callback' ) repo_search = RepoSearch() results = repo_search.search( trans, search_term, page ) results[ 'hostname' ] = url_for( '/', qualified = True ) - response = '%s(%s);' % ( callback, json.dumps( results ) ) + + if jsonp: + response = '%s(%s);' % ( callback, json.dumps( results ) ) + else: + response = json.dumps( results ) return response diff -r 54a0ae599d9c3bf40f57d86e12360ef74118dadb -r 394f11c097071738b81cec7e86080e53e697a151 lib/galaxy/webapps/tool_shed/search/repo_search.py --- a/lib/galaxy/webapps/tool_shed/search/repo_search.py +++ b/lib/galaxy/webapps/tool_shed/search/repo_search.py @@ -33,6 +33,7 @@ full_last_updated = STORED ) except ImportError, e: + log.error( 'There was an error while importing the Whoosh library.' ) search_ready = False schema = None https://bitbucket.org/galaxy/galaxy-central/commits/c57e9f8e05eb/ Changeset: c57e9f8e05eb User: martenson Date: 2015-02-09 21:39:11+00:00 Summary: load param as bool Affected #: 1 file diff -r 394f11c097071738b81cec7e86080e53e697a151 -r c57e9f8e05eb20f2ec8efd39ac53edeeaad4d6d1 lib/galaxy/webapps/tool_shed/api/search.py --- a/lib/galaxy/webapps/tool_shed/api/search.py +++ b/lib/galaxy/webapps/tool_shed/api/search.py @@ -1,8 +1,8 @@ """API for searching the toolshed repositories""" from galaxy import exceptions from galaxy import eggs +from galaxy import util from galaxy.web import _future_expose_api as expose_api -# from galaxy.web import _future_expose_api_anonymous as expose_api_anonymous from galaxy.web import _future_expose_api_raw_anonymous as expose_api_raw_anonymous from galaxy.web.base.controller import BaseAPIController from galaxy.webapps.tool_shed.search.repo_search import RepoSearch @@ -39,7 +39,7 @@ raise exceptions.RequestParameterInvalidException( 'The search term has to be at least 3 characters long.' ) page = kwd.get( 'page', 1 ) - return_jsonp = kwd.get( 'jsonp', False ) + return_jsonp = util.asbool( kwd.get( 'jsonp', False ) ) callback = kwd.get( 'callback', 'callback' ) repo_search = RepoSearch() Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.