commit/galaxy-central: 3 new changesets
3 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/7a411112a661/ Changeset: 7a411112a661 User: takadonet Date: 2013-11-08 16:38:08 Summary: added API call to delete library dataset Affected #: 1 file diff -r b9e7d751cfb5a263d778786efa4e4b4e965b3992 -r 7a411112a66155050c748c667c47cf7f6dd24d7e lib/galaxy/webapps/galaxy/api/library_contents.py --- a/lib/galaxy/webapps/galaxy/api/library_contents.py +++ b/lib/galaxy/webapps/galaxy/api/library_contents.py @@ -2,8 +2,7 @@ API operations on the contents of a library. """ import logging - -from galaxy import web +from galaxy import web , exceptions from galaxy.model import ExtendedMetadata, ExtendedMetadataIndex from galaxy.web.base.controller import BaseAPIController, UsesLibraryMixin, UsesLibraryMixinItems from galaxy.web.base.controller import UsesHistoryDatasetAssociationMixin @@ -318,3 +317,67 @@ return 'LibraryFolder', content_id[1:] else: raise HTTPBadRequest( 'Malformed library content id ( %s ) specified, unable to decode.' % str( content_id ) ) + + + @web.expose_api + def delete( self, trans, library_id, id, **kwd ): + """ + delete( self, trans, library_id, id, **kwd ) + * DELETE /api/libraries/{library_id}/contents/{id} + delete the HDA with the given ``id`` + + + :type id: str + :param id: the encoded id of the library dataset to delete + :type kwd: dict + :param kwd: (optional) dictionary structure containing: + + * payload: a dictionary itself containing: + * purge: if True, purge the HDA + + :rtype: dict + :returns: an error object if an error occurred or a dictionary containing: + * id: the encoded id of the library dataset, + * deleted: if the library dataset was marked as deleted, + * purged: if the library dataset was purged + """ + # a request body is optional here + purge = False + if kwd.get( 'payload', None ): + purge = util.string_as_bool( kwd['payload'].get( 'purge', False ) ) + rval = { 'id' : id } + try: + hda = self.get_library_dataset( trans, id, check_ownership=False, check_accessible=True ) + hda.deleted = True + if purge: + if not trans.app.config.allow_user_dataset_purge: + raise exceptions.httpexceptions.HTTPForbidden( + detail='This instance does not allow user dataset purging' ) + hda.purged = True + trans.sa_session.add( hda ) + trans.sa_session.flush() + if hda.dataset.user_can_purge: + try: + hda.dataset.full_delete() + trans.sa_session.add( hda.dataset ) + except: + pass + # 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 ) ) + raise + except exceptions.httpexceptions.HTTPException: + raise + except Exception, exc: + log.exception( 'HDA API, delete: uncaught exception: %s, %s\n%s', + id, str( kwd ), str( exc ) ) + trans.response.status = 500 + rval.update({ 'error': str( exc ) }) + return rval + + https://bitbucket.org/galaxy/galaxy-central/commits/69669b88ac78/ Changeset: 69669b88ac78 User: takadonet Date: 2013-11-08 16:38:37 Summary: Merged galaxy/galaxy-central into default Affected #: 1 file diff -r 7a411112a66155050c748c667c47cf7f6dd24d7e -r 69669b88ac784f8db470772f15bb17e13c314fa7 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -174,8 +174,12 @@ def to_dict( self, trans, view='collection', value_mapper=None ): """ to_dict tool parameter. This can be overridden by subclasses. """ tool_dict = super( ToolParameter, self ).to_dict() - #TODO: removing html as it causes a lot of errors on subclasses - needs histories, etc. - #tool_dict[ 'html' ] = urllib.quote( self.get_html( trans ) ) + #TODO: wrapping html as it causes a lot of errors on subclasses - needs histories, etc. + try: + tool_dict[ 'html' ] = urllib.quote( self.get_html( trans ) ) + except AssertionError, e: + pass #HACK for assert trans.history, 'requires a history' + tool_dict[ 'model_class' ] = self.__class__.__name__ if hasattr( self, 'value' ): tool_dict[ 'value' ] = self.value https://bitbucket.org/galaxy/galaxy-central/commits/d7b4edc2d749/ Changeset: d7b4edc2d749 User: carlfeberhard Date: 2014-01-10 19:59:58 Summary: Merged in takadonet/galaxy-central-takadonet (pull request #253) Add API call to allow for deletion/purge of dataset in a data library Affected #: 1 file diff -r c04e79918595e0cefe85edac156ff5a962f4a686 -r d7b4edc2d749d9835f61dccaab0e17614a9cd336 lib/galaxy/webapps/galaxy/api/library_contents.py --- a/lib/galaxy/webapps/galaxy/api/library_contents.py +++ b/lib/galaxy/webapps/galaxy/api/library_contents.py @@ -2,8 +2,7 @@ API operations on the contents of a library. """ import logging - -from galaxy import web +from galaxy import web , exceptions from galaxy.model import ExtendedMetadata, ExtendedMetadataIndex from galaxy.web.base.controller import BaseAPIController, UsesLibraryMixin, UsesLibraryMixinItems from galaxy.web.base.controller import UsesHistoryDatasetAssociationMixin @@ -318,3 +317,67 @@ return 'LibraryFolder', content_id[1:] else: raise HTTPBadRequest( 'Malformed library content id ( %s ) specified, unable to decode.' % str( content_id ) ) + + + @web.expose_api + def delete( self, trans, library_id, id, **kwd ): + """ + delete( self, trans, library_id, id, **kwd ) + * DELETE /api/libraries/{library_id}/contents/{id} + delete the HDA with the given ``id`` + + + :type id: str + :param id: the encoded id of the library dataset to delete + :type kwd: dict + :param kwd: (optional) dictionary structure containing: + + * payload: a dictionary itself containing: + * purge: if True, purge the HDA + + :rtype: dict + :returns: an error object if an error occurred or a dictionary containing: + * id: the encoded id of the library dataset, + * deleted: if the library dataset was marked as deleted, + * purged: if the library dataset was purged + """ + # a request body is optional here + purge = False + if kwd.get( 'payload', None ): + purge = util.string_as_bool( kwd['payload'].get( 'purge', False ) ) + rval = { 'id' : id } + try: + hda = self.get_library_dataset( trans, id, check_ownership=False, check_accessible=True ) + hda.deleted = True + if purge: + if not trans.app.config.allow_user_dataset_purge: + raise exceptions.httpexceptions.HTTPForbidden( + detail='This instance does not allow user dataset purging' ) + hda.purged = True + trans.sa_session.add( hda ) + trans.sa_session.flush() + if hda.dataset.user_can_purge: + try: + hda.dataset.full_delete() + trans.sa_session.add( hda.dataset ) + except: + pass + # 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 ) ) + raise + except exceptions.httpexceptions.HTTPException: + raise + except Exception, exc: + log.exception( 'HDA API, delete: uncaught exception: %s, %s\n%s', + id, str( kwd ), str( exc ) ) + trans.response.status = 500 + rval.update({ 'error': str( exc ) }) + return rval + + 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