1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/4ab2017348e2/ Changeset: 4ab2017348e2 User: jmchilton Date: 2014-01-10 22:08:30 Summary: PEP-8 fixes for pages API. Affected #: 2 files diff -r 43a964de0758ea9deffb88fd2c59441a13cae14b -r 4ab2017348e25958bcd8babd8e110f574dff24df lib/galaxy/webapps/galaxy/api/page_revisions.py --- a/lib/galaxy/webapps/galaxy/api/page_revisions.py +++ b/lib/galaxy/webapps/galaxy/api/page_revisions.py @@ -4,13 +4,12 @@ import logging from galaxy import web from galaxy.web.base.controller import SharableItemSecurityMixin, BaseAPIController, SharableMixin -from galaxy.model.search import GalaxySearchEngine from galaxy.model.item_attrs import UsesAnnotations -from galaxy.exceptions import ItemAccessibilityException from galaxy.util.sanitize_html import sanitize_html log = logging.getLogger( __name__ ) + class PageRevisionsController( BaseAPIController, SharableItemSecurityMixin, UsesAnnotations, SharableMixin ): @web.expose_api @@ -32,7 +31,6 @@ out.append( self.encode_all_ids( trans, page.to_dict(), True) ) return out - @web.expose_api def create( self, trans, page_id, payload, **kwd ): """ @@ -46,11 +44,10 @@ 'content' = New content of the page :rtype: dictionary - :returns: Dictionary with 'success' or 'error' element to indicate the result of the request + :returns: Dictionary with 'success' or 'error' element to indicate the result of the request """ - user = trans.get_user() error_str = "" - + if not page_id: error_str = "page_id is required" elif not payload.get("content", None): @@ -61,7 +58,7 @@ page = trans.sa_session.query( trans.app.model.Page ).get( trans.security.decode_id(page_id) ) if page is None: return { "error" : "page not found"} - + if not self.security_check( trans, page, True, True ): return { "error" : "page not found"} @@ -82,6 +79,6 @@ session = trans.sa_session session.flush() - return {"success" : "revision posted"} - - return { "error" : error_str } + return { "success" : "revision posted" } + + return { "error" : error_str } diff -r 43a964de0758ea9deffb88fd2c59441a13cae14b -r 4ab2017348e25958bcd8babd8e110f574dff24df lib/galaxy/webapps/galaxy/api/pages.py --- a/lib/galaxy/webapps/galaxy/api/pages.py +++ b/lib/galaxy/webapps/galaxy/api/pages.py @@ -4,13 +4,12 @@ import logging from galaxy import web from galaxy.web.base.controller import SharableItemSecurityMixin, BaseAPIController, SharableMixin -from galaxy.model.search import GalaxySearchEngine from galaxy.model.item_attrs import UsesAnnotations -from galaxy.exceptions import ItemAccessibilityException from galaxy.util.sanitize_html import sanitize_html log = logging.getLogger( __name__ ) + class PagesController( BaseAPIController, SharableItemSecurityMixin, UsesAnnotations, SharableMixin ): @web.expose_api @@ -26,7 +25,7 @@ :returns: dictionaries containing summary or detailed Page information """ out = [] - + if trans.user_is_admin(): r = trans.sa_session.query( trans.app.model.Page ) if not deleted: @@ -48,7 +47,6 @@ return out - @web.expose_api def create( self, trans, payload, **kwd ): """ @@ -67,7 +65,7 @@ """ user = trans.get_user() error_str = "" - + if not payload.get("title", None): error_str = "Page name is required" elif not payload.get("slug", None): @@ -85,7 +83,7 @@ page = trans.app.model.Page() page.title = payload['title'] page.slug = payload['slug'] - page_annotation = sanitize_html( payload.get("annotation",""), 'utf-8', 'text/html' ) + page_annotation = sanitize_html( payload.get( "annotation", "" ), 'utf-8', 'text/html' ) self.add_item_annotation( trans.sa_session, trans.get_user(), page, page_annotation ) page.user = user # And the first (empty) page revision @@ -99,11 +97,10 @@ session.add( page ) session.flush() - rval = self.encode_all_ids( trans, page.to_dict(), True) + rval = self.encode_all_ids( trans, page.to_dict(), True ) return rval - - return { "error" : error_str } + return { "error" : error_str } @web.expose_api def delete( self, trans, id, **kwd ): @@ -115,9 +112,9 @@ :param id: ID of page to be deleted :rtype: dict - :returns: Dictionary with 'success' or 'error' element to indicate the result of the request + :returns: Dictionary with 'success' or 'error' element to indicate the result of the request """ - page_id = id; + page_id = id try: page = trans.sa_session.query(self.app.model.Page).get(trans.security.decode_id(page_id)) except Exception, e: @@ -130,7 +127,7 @@ #Mark a workflow as deleted page.deleted = True trans.sa_session.flush() - return {"success" : "Deleted", "id" : page_id} + return { "success" : "Deleted", "id" : page_id } @web.expose_api def show( self, trans, id, **kwd ): @@ -146,6 +143,6 @@ """ page = trans.sa_session.query( trans.app.model.Page ).get( trans.security.decode_id( id ) ) self.security_check( trans, page, check_ownership=False, check_accessible=True) - rval = self.encode_all_ids( trans, page.to_dict(), True) + rval = self.encode_all_ids( trans, page.to_dict(), True ) rval['content'] = page.latest_revision.content - return rval \ No newline at end of file + 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.