commit/galaxy-central: carlfeberhard: HDA API: return purged with summary data, allow purge flag in query or payload for DELETE
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/6be4eb823a7e/ Changeset: 6be4eb823a7e User: carlfeberhard Date: 2013-12-05 20:15:43 Summary: HDA API: return purged with summary data, allow purge flag in query or payload for DELETE Affected #: 1 file diff -r bba295ef97e41acfcf3e160d1d3067d4ee0e81a1 -r 6be4eb823a7ea30f35411251900487ee92734b7e lib/galaxy/webapps/galaxy/api/history_contents.py --- a/lib/galaxy/webapps/galaxy/api/history_contents.py +++ b/lib/galaxy/webapps/galaxy/api/history_contents.py @@ -120,6 +120,7 @@ 'state' : hda.state, 'deleted': hda.deleted, 'visible': hda.visible, + 'purged': hda.purged, 'hid' : hda.hid, 'url' : url_for( 'history_content', history_id=encoded_history_id, id=encoded_id, ), } @@ -309,8 +310,9 @@ return { 'error': str( exception ) } return changed + #TODO: allow anonymous del/purge and test security on this @web.expose_api - def delete( self, trans, history_id, id, **kwd ): + def delete( self, trans, history_id, id, purge=False, **kwd ): """ delete( self, trans, history_id, id, **kwd ) * DELETE /api/histories/{history_id}/contents/{id} @@ -319,22 +321,29 @@ :type id: str :param id: the encoded id of the history to delete + :type purge: bool + :param purge: if True, purge the HDA :type kwd: dict :param kwd: (optional) dictionary structure containing: * payload: a dictionary itself containing: * purge: if True, purge the HDA + .. note:: that payload optionally can be placed in the query string of the request. + This allows clients that strip the request body to still purge the dataset. + :rtype: dict :returns: an error object if an error occurred or a dictionary containing: * id: the encoded id of the history, * deleted: if the history was marked as deleted, * purged: if the history was purged """ - # a request body is optional here - purge = False + # get purge from the query or from the request body payload (a request body is optional here) + purge = util.string_as_bool( purge ) if kwd.get( 'payload', None ): - purge = util.string_as_bool( kwd['payload'].get( 'purge', False ) ) + # payload takes priority + purge = util.string_as_bool( kwd['payload'].get( 'purge', purge ) ) + rval = { 'id' : id } try: hda = self.get_dataset( trans, id, @@ -356,8 +365,10 @@ # flush now to preserve deleted state in case of later interruption trans.sa_session.flush() rval[ 'purged' ] = True + trans.sa_session.flush() rval[ 'deleted' ] = True + except exceptions.httpexceptions.HTTPInternalServerError, http_server_err: log.exception( 'HDA API, delete: uncaught HTTPInternalServerError: %s, %s\n%s', id, str( kwd ), str( http_server_err ) ) 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.
participants (1)
-
commits-noreply@bitbucket.org