1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/72cf2a3a6a2a/ Changeset: 72cf2a3a6a2a User: carlfeberhard Date: 2013-07-22 23:04:52 Summary: API histories, delete: ensure HTTPExceptions are raised, better return values; API workflows delete: add code 400 to not found clause, change to code 403 for not accessible clause Affected #: 2 files diff -r 3a27539764348d4099669bc7fe94c9432e62aff0 -r 72cf2a3a6a2a5d476022072b6646dfbc1d519b09 lib/galaxy/webapps/galaxy/api/histories.py --- a/lib/galaxy/webapps/galaxy/api/histories.py +++ b/lib/galaxy/webapps/galaxy/api/histories.py @@ -4,7 +4,7 @@ import pkg_resources pkg_resources.require( "Paste" ) -from paste.httpexceptions import HTTPBadRequest, HTTPForbidden +from paste.httpexceptions import HTTPBadRequest, HTTPForbidden, HTTPInternalServerError, HTTPException from galaxy import web from galaxy.util import string_as_bool, restore_text @@ -124,6 +124,7 @@ if kwd.get( 'payload', None ): purge = string_as_bool( kwd['payload'].get( 'purge', False ) ) + rval = { 'id' : history_id } try: history = self.get_history( trans, history_id, check_ownership=True, check_accessible=False ) history.deleted = True @@ -152,14 +153,24 @@ # Now mark the history as purged history.purged = True self.sa_session.add( history ) + rval[ 'purged' ] = True trans.sa_session.flush() + rval[ 'deleted' ] = True - #TODO: better feedback than this... - except Exception, e: - return str( e ) + except HTTPInternalServerError, http_server_err: + log.exception( 'Histories API, delete: uncaught HTTPInternalServerError: %s, %s\n%s', + history_id, str( kwd ), str( http_server_err ) ) + raise + except HTTPException, http_exc: + raise + except Exception, exc: + log.exception( 'Histories API, delete: uncaught exception: %s, %s\n%s', + history_id, str( kwd ), str( exc ) ) + trans.response.status = 500 + rval.update({ 'error': str( exc ) }) - return 'OK' + return rval @web.expose_api def undelete( self, trans, id, **kwd ): diff -r 3a27539764348d4099669bc7fe94c9432e62aff0 -r 72cf2a3a6a2a5d476022072b6646dfbc1d519b09 lib/galaxy/webapps/galaxy/api/workflows.py --- a/lib/galaxy/webapps/galaxy/api/workflows.py +++ b/lib/galaxy/webapps/galaxy/api/workflows.py @@ -290,13 +290,14 @@ try: stored_workflow = trans.sa_session.query(self.app.model.StoredWorkflow).get(trans.security.decode_id(workflow_id)) - except Exception,e: + except Exception, e: + trans.response.status = 400 return ("Workflow with ID='%s' can not be found\n Exception: %s") % (workflow_id, str( e )) # check to see if user has permissions to selected workflow if stored_workflow.user != trans.user and not trans.user_is_admin(): if trans.sa_session.query(trans.app.model.StoredWorkflowUserShareAssociation).filter_by(user=trans.user, stored_workflow=stored_workflow).count() == 0: - trans.response.status = 400 + trans.response.status = 403 return("Workflow is not owned by or shared with current user") #Mark a workflow as deleted 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.