commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/119898e03506/ Changeset: 119898e03506 User: carlfeberhard Date: 2015-02-02 22:08:17+00:00 Summary: API, tags & annotations: use _future_expose_api and minor clean up Affected #: 2 files diff -r 117db343f853b815b6f584679c23d0f44277c07b -r 119898e035065e3ffd1ca9b3e84f23f380faf023 lib/galaxy/webapps/galaxy/api/annotations.py --- a/lib/galaxy/webapps/galaxy/api/annotations.py +++ b/lib/galaxy/webapps/galaxy/api/annotations.py @@ -1,27 +1,31 @@ """ API operations on annotations. """ -import logging -from galaxy import web + +from galaxy.web.base.controller import BaseAPIController +from galaxy.web.base.controller import UsesStoredWorkflowMixin from galaxy.model.item_attrs import UsesAnnotations -from galaxy.util.sanitize_html import sanitize_html -from galaxy.web.base.controller import BaseAPIController, HTTPNotImplemented, UsesStoredWorkflowMixin from galaxy import managers +from galaxy import exceptions +from galaxy.web import _future_expose_api as expose_api +from galaxy.util import sanitize_html + +import logging log = logging.getLogger( __name__ ) class BaseAnnotationsController( BaseAPIController, UsesStoredWorkflowMixin, UsesAnnotations ): - @web.expose_api + @expose_api def index( self, trans, **kwd ): idnum = kwd[self.tagged_item_id] item = self._get_item_from_id(trans, idnum) if item is not None: return self.get_item_annotation_str( trans.sa_session, trans.get_user(), item ) - @web.expose_api + @expose_api def create( self, trans, payload, **kwd ): if "text" not in payload: return "" @@ -29,24 +33,24 @@ item = self._get_item_from_id(trans, idnum) if item is not None: new_annotation = payload.get("text") - # Sanitize annotation before adding it. - new_annotation = sanitize_html( new_annotation, 'utf-8', 'text/html' ) + #TODO: sanitize on display not entry + new_annotation = sanitize_html.sanitize_html( new_annotation, 'utf-8', 'text/html' ) self.add_item_annotation( trans.sa_session, trans.get_user(), item, new_annotation ) trans.sa_session.flush() return new_annotation return "" - @web.expose_api + @expose_api def delete( self, trans, **kwd ): idnum = kwd[self.tagged_item_id] item = self._get_item_from_id(trans, idnum) if item is not None: return self.delete_item_annotation( trans.sa_session, trans.get_user(), item ) - @web.expose_api + @expose_api def undelete( self, trans, **kwd ): - raise HTTPNotImplemented() + raise exceptions.NotImplemented() class HistoryAnnotationsController(BaseAnnotationsController): @@ -63,7 +67,7 @@ return history -class HistoryContentAnnotationsController(BaseAnnotationsController): +class HistoryContentAnnotationsController( BaseAnnotationsController ): controller_name = "history_content_annotations" tagged_item_id = "history_content_id" @@ -78,10 +82,10 @@ return hda -class WorkflowAnnotationsController(BaseAnnotationsController): +class WorkflowAnnotationsController( BaseAnnotationsController ): controller_name = "workflow_annotations" tagged_item_id = "workflow_id" def _get_item_from_id(self, trans, idstr): - hda = self.get_stored_workflow(trans, idstr) + hda = self.get_stored_workflow( trans, idstr ) return hda diff -r 117db343f853b815b6f584679c23d0f44277c07b -r 119898e035065e3ffd1ca9b3e84f23f380faf023 lib/galaxy/webapps/galaxy/api/item_tags.py --- a/lib/galaxy/webapps/galaxy/api/item_tags.py +++ b/lib/galaxy/webapps/galaxy/api/item_tags.py @@ -1,52 +1,55 @@ """ API operations related to tagging items. """ +from galaxy.web.base.controller import BaseAPIController +from galaxy.web.base.controller import UsesTagsMixin + +from galaxy.web import _future_expose_api as expose_api +from galaxy import exceptions + import logging -from galaxy import web -from galaxy.web.base.controller import BaseAPIController, UsesTagsMixin -from paste.httpexceptions import HTTPBadRequest - log = logging.getLogger( __name__ ) class BaseItemTagsController( BaseAPIController, UsesTagsMixin ): """ """ - @web.expose_api + @expose_api def index( self, trans, **kwd ): """ """ - tags = self._get_user_tags(trans, self.tagged_item_class, kwd[self.tagged_item_id]) + tags = self._get_user_tags(trans, self.tagged_item_class, kwd[ self.tagged_item_id ]) return [ self._api_value( tag, trans, view='collection' ) for tag in tags ] - @web.expose_api + @expose_api def show( self, trans, tag_name, **kwd ): """ """ - tag = self._get_item_tag_assoc( trans, self.tagged_item_class, kwd[self.tagged_item_id], tag_name ) + tag = self._get_item_tag_assoc( trans, self.tagged_item_class, kwd[ self.tagged_item_id ], tag_name ) if not tag: - raise HTTPBadRequest("Failed to retrieve specified tag.") + raise exceptions.ObjectNotFound( "Failed to retrieve specified tag." ) return self._api_value( tag, trans ) - @web.expose_api + @expose_api def create( self, trans, tag_name, payload=None, **kwd ): """ """ payload = payload or {} - value = payload.get("value", None) - tag = self._apply_item_tag( trans, self.tagged_item_class, kwd[self.tagged_item_id], tag_name, value ) + value = payload.get( "value", None ) + tag = self._apply_item_tag( trans, self.tagged_item_class, kwd[ self.tagged_item_id ], tag_name, value ) return self._api_value( tag, trans ) # Not handling these differently at this time update = create - @web.expose_api + @expose_api def delete( self, trans, tag_name, **kwd ): """ """ - deleted = self._remove_items_tag( trans, self.tagged_item_class, kwd[self.tagged_item_id], tag_name ) + deleted = self._remove_items_tag( trans, self.tagged_item_class, kwd[ self.tagged_item_id ], tag_name ) if not deleted: - raise HTTPBadRequest("Failed to delete specified tag.") + raise exceptions.RequestParameterInvalidException( "Failed to delete specified tag." ) + #TODO: ugh - 204 would be better return 'OK' def _api_value( self, tag, trans, view='element' ): https://bitbucket.org/galaxy/galaxy-central/commits/83414d1a3943/ Changeset: 83414d1a3943 User: carlfeberhard Date: 2015-02-02 22:09:12+00:00 Summary: Core, startup: add deprecation log.warn if using 'pack_scripts' option Affected #: 1 file diff -r 119898e035065e3ffd1ca9b3e84f23f380faf023 -r 83414d1a3943a6902fe63509b07ed46cba874951 lib/galaxy/webapps/galaxy/buildapp.py --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -90,6 +90,7 @@ webapp = wrap_in_static( webapp, global_conf, plugin_frameworks=[ app.visualizations_registry ], **kwargs ) #webapp = wrap_in_static( webapp, global_conf, plugin_frameworks=None, **kwargs ) if asbool(kwargs.get('pack_scripts', False)): + log.warn( "The 'pack_scripts' option is deprecated" ) pack_scripts() # Close any pooled database connections before forking try: 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