commit/galaxy-central: greg: Look for the webapp setting in the request's environ if it is not included in the request's parameters.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/98204b9f4f80/ changeset: 98204b9f4f80 user: greg date: 2012-07-05 19:54:31 summary: Look for the webapp setting in the request's environ if it is not included in the request's parameters. affected #: 11 files diff -r e7e59c068d7002e48eebb9dc6f34721fb7456fb5 -r 98204b9f4f806c15fa52fd728b5dacbc64f5eeb1 lib/galaxy/web/base/controller.py --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -1552,7 +1552,7 @@ @web.expose @web.require_admin def index( self, trans, **kwd ): - webapp = kwd.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) message = kwd.get( 'message', '' ) status = kwd.get( 'status', 'done' ) if webapp == 'galaxy': @@ -1572,7 +1572,7 @@ @web.expose @web.require_admin def center( self, trans, **kwd ): - webapp = kwd.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) message = kwd.get( 'message', '' ) status = kwd.get( 'status', 'done' ) if webapp == 'galaxy': @@ -1629,7 +1629,7 @@ @web.require_admin def create_role( self, trans, **kwd ): params = util.Params( kwd ) - webapp = params.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) name = util.restore_text( params.get( 'name', '' ) ) @@ -1706,7 +1706,7 @@ @web.require_admin def rename_role( self, trans, **kwd ): params = util.Params( kwd ) - webapp = params.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) id = params.get( 'id', None ) @@ -1751,7 +1751,7 @@ @web.require_admin def manage_users_and_groups_for_role( self, trans, **kwd ): params = util.Params( kwd ) - webapp = params.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) id = params.get( 'id', None ) @@ -1846,7 +1846,7 @@ @web.require_admin def mark_role_deleted( self, trans, **kwd ): params = util.Params( kwd ) - webapp = params.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) id = kwd.get( 'id', None ) if not id: message = "No role ids received for deleting" @@ -1872,7 +1872,7 @@ @web.require_admin def undelete_role( self, trans, **kwd ): params = util.Params( kwd ) - webapp = params.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) id = kwd.get( 'id', None ) if not id: message = "No role ids received for undeleting" @@ -1915,7 +1915,7 @@ # - GroupRoleAssociations where role_id == Role.id # - DatasetPermissionss where role_id == Role.id params = util.Params( kwd ) - webapp = params.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) id = kwd.get( 'id', None ) if not id: message = "No role ids received for purging" @@ -1988,7 +1988,7 @@ @web.require_admin def rename_group( self, trans, **kwd ): params = util.Params( kwd ) - webapp = params.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) id = params.get( 'id', None ) @@ -2031,7 +2031,7 @@ @web.require_admin def manage_users_and_roles_for_group( self, trans, **kwd ): params = util.Params( kwd ) - webapp = params.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) group = get_group( trans, params.id ) @@ -2078,7 +2078,7 @@ @web.require_admin def create_group( self, trans, **kwd ): params = util.Params( kwd ) - webapp = params.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) name = util.restore_text( params.get( 'name', '' ) ) @@ -2156,7 +2156,7 @@ @web.require_admin def mark_group_deleted( self, trans, **kwd ): params = util.Params( kwd ) - webapp = params.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) id = params.get( 'id', None ) if not id: message = "No group ids received for marking deleted" @@ -2182,7 +2182,7 @@ @web.require_admin def undelete_group( self, trans, **kwd ): params = util.Params( kwd ) - webapp = params.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) id = kwd.get( 'id', None ) if not id: message = "No group ids received for undeleting" @@ -2220,7 +2220,7 @@ # This method should only be called for a Group that has previously been deleted. # Purging a deleted Group simply deletes all UserGroupAssociations and GroupRoleAssociations. params = util.Params( kwd ) - webapp = params.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) id = kwd.get( 'id', None ) if not id: message = "No group ids received for purging" @@ -2259,7 +2259,7 @@ @web.expose @web.require_admin def create_new_user( self, trans, **kwd ): - webapp = kwd.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) return trans.response.send_redirect( web.url_for( controller='user', action='create', cntrller='admin', @@ -2267,7 +2267,7 @@ @web.expose @web.require_admin def reset_user_password( self, trans, **kwd ): - webapp = kwd.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) user_id = kwd.get( 'id', None ) if not user_id: message = "No users received for resetting passwords." @@ -2316,7 +2316,7 @@ @web.expose @web.require_admin def mark_user_deleted( self, trans, **kwd ): - webapp = kwd.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) id = kwd.get( 'id', None ) if not id: message = "No user ids received for deleting" @@ -2341,7 +2341,7 @@ @web.expose @web.require_admin def undelete_user( self, trans, **kwd ): - webapp = kwd.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) id = kwd.get( 'id', None ) if not id: message = "No user ids received for undeleting" @@ -2388,7 +2388,7 @@ # - UserRoleAssociation where user_id == User.id EXCEPT FOR THE PRIVATE ROLE # - UserAddress where user_id == User.id # Purging Histories and Datasets must be handled via the cleanup_datasets.py script - webapp = kwd.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) id = kwd.get( 'id', None ) if not id: message = "No user ids received for purging" @@ -2493,7 +2493,7 @@ @web.expose @web.require_admin def manage_roles_and_groups_for_user( self, trans, **kwd ): - webapp = kwd.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) user_id = kwd.get( 'id', None ) message = '' status = '' @@ -2714,3 +2714,11 @@ id = trans.security.decode_id( id ) quota = trans.sa_session.query( trans.model.Quota ).get( id ) return quota +def get_webapp( trans, **kwd ): + """Get the value of the webapp, can be one of 'community', 'galaxy', 'reports', 'demo_sequencer'.""" + if 'webapp' in kwd: + return kwd[ 'webapp' ] + if 'webapp' in trans.environ: + return trans.environ[ 'webapp' ] + # The default is galaxy. + return 'galaxy' diff -r e7e59c068d7002e48eebb9dc6f34721fb7456fb5 -r 98204b9f4f806c15fa52fd728b5dacbc64f5eeb1 lib/galaxy/web/controllers/admin.py --- a/lib/galaxy/web/controllers/admin.py +++ b/lib/galaxy/web/controllers/admin.py @@ -51,7 +51,6 @@ return 'never' # Grid definition - webapp = "galaxy" title = "Users" model_class = model.User template='/admin/user/grid.mako' @@ -136,7 +135,6 @@ return 0 # Grid definition - webapp = "galaxy" title = "Roles" model_class = model.Role template='/admin/dataset_security/role/grid.mako' @@ -220,7 +218,6 @@ return 0 # Grid definition - webapp = "galaxy" title = "Groups" model_class = model.Group template='/admin/dataset_security/group/grid.mako' @@ -302,7 +299,6 @@ return 0 # Grid definition - webapp = "galaxy" title = "Quotas" model_class = model.Quota template='/admin/quota/grid.mako' diff -r e7e59c068d7002e48eebb9dc6f34721fb7456fb5 -r 98204b9f4f806c15fa52fd728b5dacbc64f5eeb1 lib/galaxy/web/controllers/admin_toolshed.py --- a/lib/galaxy/web/controllers/admin_toolshed.py +++ b/lib/galaxy/web/controllers/admin_toolshed.py @@ -147,7 +147,6 @@ ( bgcolor, trans.security.encode_id( tool_shed_repository.id ), status_label ) return rval - webapp = "galaxy" title = "Monitor installing tool shed repositories" template = "admin/tool_shed_repository/repository_installation_grid.mako" model_class = model.ToolShedRepository @@ -230,7 +229,6 @@ ( bgcolor, trans.security.encode_id( tool_dependency.id ), tool_dependency.status ) return rval - webapp = "galaxy" title = "Tool Dependencies" template = "admin/tool_shed_repository/tool_dependencies_grid.mako" model_class = model.ToolDependency @@ -1516,7 +1514,7 @@ params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) - webapp = params.get( 'webapp', 'community' ) + webapp = get_webapp( trans, **kwd ) repository = get_repository( trans, repository_id ) metadata = {} tool = None diff -r e7e59c068d7002e48eebb9dc6f34721fb7456fb5 -r 98204b9f4f806c15fa52fd728b5dacbc64f5eeb1 lib/galaxy/web/controllers/external_service.py --- a/lib/galaxy/web/controllers/external_service.py +++ b/lib/galaxy/web/controllers/external_service.py @@ -21,7 +21,6 @@ return 'Error in loading external_service type: %s' % external_service.external_service_type_id # Grid definition - webapp = "galaxy" title = "External Services" template = "admin/external_service/grid.mako" model_class = model.ExternalService diff -r e7e59c068d7002e48eebb9dc6f34721fb7456fb5 -r 98204b9f4f806c15fa52fd728b5dacbc64f5eeb1 lib/galaxy/web/controllers/request_type.py --- a/lib/galaxy/web/controllers/request_type.py +++ b/lib/galaxy/web/controllers/request_type.py @@ -28,7 +28,6 @@ return len( request_type.external_services ) return 'No external service assigned' # Grid definition - webapp = "galaxy" title = "Request Types" template = "admin/request_type/grid.mako" model_class = model.RequestType diff -r e7e59c068d7002e48eebb9dc6f34721fb7456fb5 -r 98204b9f4f806c15fa52fd728b5dacbc64f5eeb1 lib/galaxy/web/controllers/requests_admin.py --- a/lib/galaxy/web/controllers/requests_admin.py +++ b/lib/galaxy/web/controllers/requests_admin.py @@ -47,7 +47,6 @@ except: return 'None' # Grid definition - webapp = "galaxy" title = "Sample Datasets" template = "admin/requests/sample_datasets_grid.mako" model_class = model.SampleDataset diff -r e7e59c068d7002e48eebb9dc6f34721fb7456fb5 -r 98204b9f4f806c15fa52fd728b5dacbc64f5eeb1 lib/galaxy/web/controllers/user.py --- a/lib/galaxy/web/controllers/user.py +++ b/lib/galaxy/web/controllers/user.py @@ -514,7 +514,7 @@ params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) - webapp = params.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) use_panels = util.string_as_bool( kwd.get( 'use_panels', True ) ) email = util.restore_text( params.get( 'email', '' ) ) # Do not sanitize passwords, so take from kwd @@ -597,7 +597,7 @@ email = util.restore_text( kwd.get( 'email', '' ) ) password = kwd.get( 'password', '' ) username = util.restore_text( kwd.get( 'username', '' ) ) - webapp = kwd.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) status = kwd.get( 'status', 'done' ) is_admin = cntrller == 'admin' and trans.user_is_admin() user = trans.app.model.User( email=email ) @@ -694,7 +694,7 @@ user = trans.user if not user: raise AssertionError, "The user id (%s) is not valid" % str( user_id ) - webapp = params.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) email = util.restore_text( params.get( 'email', user.email ) ) # Do not sanitize passwords, so take from kwd # instead of params ( which were sanitized ) @@ -759,7 +759,7 @@ def edit_username( self, trans, cntrller, **kwd ): params = util.Params( kwd ) is_admin = cntrller == 'admin' and trans.user_is_admin() - webapp = params.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) user_id = params.get( 'user_id', None ) @@ -789,7 +789,7 @@ def edit_info( self, trans, cntrller, **kwd ): params = util.Params( kwd ) is_admin = cntrller == 'admin' and trans.user_is_admin() - webapp = params.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) user_id = params.get( 'user_id', None ) diff -r e7e59c068d7002e48eebb9dc6f34721fb7456fb5 -r 98204b9f4f806c15fa52fd728b5dacbc64f5eeb1 lib/galaxy/web/controllers/workflow.py --- a/lib/galaxy/web/controllers/workflow.py +++ b/lib/galaxy/web/controllers/workflow.py @@ -1033,7 +1033,7 @@ """ url = kwd.get( 'url', '' ) workflow_text = kwd.get( 'workflow_text', '' ) - webapp = kwd.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwd ) message = kwd.get( 'message', '' ) status = kwd.get( 'status', 'done' ) import_button = kwd.get( 'import_button', False ) diff -r e7e59c068d7002e48eebb9dc6f34721fb7456fb5 -r 98204b9f4f806c15fa52fd728b5dacbc64f5eeb1 lib/galaxy/web/framework/helpers/grids.py --- a/lib/galaxy/web/framework/helpers/grids.py +++ b/lib/galaxy/web/framework/helpers/grids.py @@ -53,7 +53,7 @@ def __call__( self, trans, **kwargs ): # Get basics. - webapp = kwargs.get( 'webapp', 'galaxy' ) + webapp = get_webapp( trans, **kwargs ) status = kwargs.get( 'status', None ) message = kwargs.get( 'message', None ) # Build a base filter and sort key that is the combination of the saved state and defaults. diff -r e7e59c068d7002e48eebb9dc6f34721fb7456fb5 -r 98204b9f4f806c15fa52fd728b5dacbc64f5eeb1 lib/galaxy/webapps/community/controllers/admin.py --- a/lib/galaxy/webapps/community/controllers/admin.py +++ b/lib/galaxy/webapps/community/controllers/admin.py @@ -60,7 +60,6 @@ return query.filter( and_( model.Tool.table.c.user_id == model.User.table.c.id, model.User.table.c.email == column_filter ) ) # Grid definition - webapp = "community" title = "Users" model_class = model.User template='/admin/user/grid.mako' @@ -148,7 +147,6 @@ return 0 # Grid definition - webapp = "community" title = "Roles" model_class = model.Role template='/admin/dataset_security/role/grid.mako' @@ -235,7 +233,6 @@ return 0 # Grid definition - webapp = "community" title = "Groups" model_class = model.Group template='/admin/dataset_security/group/grid.mako' diff -r e7e59c068d7002e48eebb9dc6f34721fb7456fb5 -r 98204b9f4f806c15fa52fd728b5dacbc64f5eeb1 lib/galaxy/webapps/community/controllers/repository.py --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -40,7 +40,6 @@ return 0 # Grid definition - webapp = "community" title = "Categories" model_class = model.Category template='/webapps/community/category/grid.mako' @@ -377,7 +376,7 @@ params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) - webapp = params.get( 'webapp', 'community' ) + webapp = get_webapp( trans, **kwd ) cntrller = params.get( 'cntrller', 'repository' ) is_admin = trans.user_is_admin() invalid_tools_dict = odict() @@ -495,7 +494,7 @@ params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) - webapp = params.get( 'webapp', 'community' ) + webapp = get_webapp( trans, **kwd ) commit_message = util.restore_text( params.get( 'commit_message', 'Deleted selected files' ) ) repository = get_repository( trans, id ) repo = hg.repository( get_configured_ui(), repository.repo_path ) @@ -511,7 +510,7 @@ status=status ) @web.expose def browse_valid_repositories( self, trans, **kwd ): - webapp = kwd.get( 'webapp', 'community' ) + webapp = get_webapp( trans, **kwd ) galaxy_url = kwd.get( 'galaxy_url', None ) if galaxy_url: trans.set_cookie( galaxy_url, name='toolshedgalaxyurl' ) @@ -596,7 +595,7 @@ name = params.get( 'name', None ) owner = params.get( 'owner', None ) changeset_revision = params.get( 'changeset_revision', None ) - webapp = params.get( 'webapp', 'community' ) + webapp = get_webapp( trans, **kwd ) repository = get_repository_by_name_and_owner( trans, name, owner ) repo_dir = repository.repo_path repo = hg.repository( get_configured_ui(), repo_dir ) @@ -769,7 +768,7 @@ params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) - webapp = params.get( 'webapp', 'community' ) + webapp = get_webapp( trans, **kwd ) repository = get_repository( trans, repository_id ) tool, message = load_tool_from_changeset_revision( trans, repository_id, changeset_revision, tool_config ) tool_state = self.__new_state( trans ) @@ -842,7 +841,7 @@ params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) - webapp = params.get( 'webapp', 'community' ) + webapp = get_webapp( trans, **kwd ) galaxy_url = kwd.get( 'galaxy_url', None ) if galaxy_url: trans.set_cookie( galaxy_url, name='toolshedgalaxyurl' ) @@ -922,7 +921,7 @@ params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) - webapp = params.get( 'webapp', 'community' ) + webapp = get_webapp( trans, **kwd ) galaxy_url = kwd.get( 'galaxy_url', None ) if galaxy_url: trans.set_cookie( galaxy_url, name='toolshedgalaxyurl' ) @@ -1050,7 +1049,7 @@ name = params.get( 'name', None ) owner = params.get( 'owner', None ) changeset_revision = params.get( 'changeset_revision', None ) - webapp = params.get( 'webapp', 'community' ) + webapp = get_webapp( trans, **kwd ) repository = get_repository_by_name_and_owner( trans, name, owner ) for downloadable_revision in repository.downloadable_revisions: if downloadable_revision.changeset_revision == changeset_revision: @@ -1204,7 +1203,7 @@ params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) - webapp = params.get( 'webapp', 'community' ) + webapp = get_webapp( trans, **kwd ) galaxy_url = trans.get_cookie( name='toolshedgalaxyurl' ) repository_clone_url = generate_clone_url( trans, repository_id ) repository = get_repository( trans, repository_id ) @@ -1241,7 +1240,7 @@ params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'error' ) - webapp = params.get( 'webapp', 'community' ) + webapp = get_webapp( trans, **kwd ) repository = get_repository( trans, repository_id ) repo_dir = repository.repo_path repo = hg.repository( get_configured_ui(), repo_dir ) @@ -1537,7 +1536,7 @@ params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) - webapp = params.get( 'webapp', 'community' ) + webapp = get_webapp( trans, **kwd ) repository = get_repository( trans, repository_id ) changeset_revision = util.restore_text( params.get( 'changeset_revision', repository.tip ) ) repository_metadata = get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision ) @@ -1999,7 +1998,7 @@ message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) repository = get_repository( trans, id ) - webapp = params.get( 'webapp', 'community' ) + webapp = get_webapp( trans, **kwd ) repo = hg.repository( get_configured_ui(), repository.repo_path ) avg_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, repository, webapp_model=trans.model ) changeset_revision = util.restore_text( params.get( 'changeset_revision', repository.tip ) ) @@ -2068,7 +2067,7 @@ params = util.Params( kwd ) message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) - webapp = params.get( 'webapp', 'community' ) + webapp = get_webapp( trans, **kwd ) repository = get_repository( trans, repository_id ) metadata = {} tool = None 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)
-
Bitbucket