commit/galaxy-central: dannon: Update controller url_for invocations, preparation for enforcing explicit controller specification in the mapper.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/022fd520c8ec/ changeset: 022fd520c8ec user: dannon date: 2013-02-06 03:48:24 summary: Update controller url_for invocations, preparation for enforcing explicit controller specification in the mapper. affected #: 7 files diff -r 7db12eb10dbb5f1857f27cab4cdefd7e86b892e1 -r 022fd520c8ec2eee6221c44213c034be504735b8 lib/galaxy/webapps/galaxy/controllers/dataset.py --- a/lib/galaxy/webapps/galaxy/controllers/dataset.py +++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py @@ -599,7 +599,7 @@ def get_name_and_link_async( self, trans, id=None ): """ Returns dataset's name and link. """ dataset = self.get_dataset( trans, id, False, True ) - return_dict = { "name" : dataset.name, "link" : url_for( action="display_by_username_and_slug", username=dataset.history.user.username, slug=trans.security.encode_id( dataset.id ) ) } + return_dict = { "name" : dataset.name, "link" : url_for( controller='dataset', action="display_by_username_and_slug", username=dataset.history.user.username, slug=trans.security.encode_id( dataset.id ) ) } return return_dict @web.expose diff -r 7db12eb10dbb5f1857f27cab4cdefd7e86b892e1 -r 022fd520c8ec2eee6221c44213c034be504735b8 lib/galaxy/webapps/galaxy/controllers/history.py --- a/lib/galaxy/webapps/galaxy/controllers/history.py +++ b/lib/galaxy/webapps/galaxy/controllers/history.py @@ -624,7 +624,7 @@ # If no source to create archive from, show form to upload archive or specify URL. if not archive_source: return trans.show_form( - web.FormBuilder( web.url_for(), "Import a History from an Archive", submit_text="Submit" ) \ + web.FormBuilder( web.url_for(controller='history', action='import_archive'), "Import a History from an Archive", submit_text="Submit" ) \ .add_input( "text", "Archived History URL", "archive_url", value="", error=None ) # TODO: add support for importing via a file. #.add_input( "file", "Archived History File", "archive_file", value=None, error=None ) @@ -684,7 +684,7 @@ return open( trans.app.object_store.get_filename( jeha.dataset ) ) elif jeha.job.state in [ model.Job.states.RUNNING, model.Job.states.QUEUED, model.Job.states.WAITING ]: return trans.show_message( "Still exporting history %(n)s; please check back soon. Link: <a href='%(s)s'>%(s)s</a>" \ - % ( { 'n' : history.name, 's' : url_for( action="export_archive", id=id, qualified=True ) } ) ) + % ( { 'n' : history.name, 's' : url_for( controller='history', action="export_archive", id=id, qualified=True ) } ) ) # Run job to do export. history_exp_tool = trans.app.toolbox.get_tool( '__EXPORT_HISTORY__' ) @@ -697,7 +697,7 @@ return trans.show_message( "Exporting History '%(n)s'. Use this link to download \ the archive or import it to another Galaxy server: \ <a href='%(u)s'>%(u)s</a>" \ - % ( { 'n' : history.name, 'u' : url_for( action="export_archive", id=id, qualified=True ) } ) ) + % ( { 'n' : history.name, 'u' : url_for(controller='history', action="export_archive", id=id, qualified=True ) } ) ) @web.expose @web.json @@ -709,7 +709,7 @@ trans.sa_session.flush() return_dict = { "name" : history.name, - "link" : url_for( action="display_by_username_and_slug", username=history.user.username, slug=history.slug ) } + "link" : url_for(controller='history', action="display_by_username_and_slug", username=history.user.username, slug=history.slug ) } return return_dict @web.expose @@ -823,7 +823,7 @@ return trans.show_warn_message( """ Warning! If you import this history, you will lose your current history. <br>You can <a href="%s">continue and import this history</a> or %s. - """ % ( web.url_for( id=id, confirm=True, referer=trans.request.referer ), referer_message ), use_panels=True ) + """ % ( web.url_for(controller='history', action='imp', id=id, confirm=True, referer=trans.request.referer ), referer_message ), use_panels=True ) @web.expose def view( self, trans, id=None, show_deleted=False, use_panels=True ): diff -r 7db12eb10dbb5f1857f27cab4cdefd7e86b892e1 -r 022fd520c8ec2eee6221c44213c034be504735b8 lib/galaxy/webapps/galaxy/controllers/page.py --- a/lib/galaxy/webapps/galaxy/controllers/page.py +++ b/lib/galaxy/webapps/galaxy/controllers/page.py @@ -18,7 +18,7 @@ # Custom column. class URLColumn( grids.PublicURLColumn ): def get_value( self, trans, grid, item ): - return url_for( action='display_by_username_and_slug', username=item.user.username, slug=item.slug ) + return url_for(controller='page', action='display_by_username_and_slug', username=item.user.username, slug=item.slug ) # Grid definition use_panels = True @@ -365,9 +365,9 @@ session.flush() # Display the management page ## trans.set_message( "Page '%s' created" % page.title ) - return trans.response.send_redirect( web.url_for( action='list' ) ) + return trans.response.send_redirect( web.url_for(controller='page', action='list' ) ) return trans.show_form( - web.FormBuilder( web.url_for(), "Create new page", submit_text="Submit" ) + web.FormBuilder( web.url_for(controller='page', action='create'), "Create new page", submit_text="Submit" ) .add_text( "page_title", "Page title", value=page_title, error=page_title_err ) .add_text( "page_slug", "Page identifier", value=page_slug, error=page_slug_err, help="""A unique identifier that will be used for @@ -410,7 +410,7 @@ self.add_item_annotation( trans.sa_session, trans.get_user(), page, page_annotation ) session.flush() # Redirect to page list. - return trans.response.send_redirect( web.url_for( action='list' ) ) + return trans.response.send_redirect( web.url_for(controller='page', action='list' ) ) else: page_title = page.title page_slug = page.slug @@ -418,7 +418,7 @@ if not page_annotation: page_annotation = "" return trans.show_form( - web.FormBuilder( web.url_for( id=encoded_id ), "Edit page attributes", submit_text="Submit" ) + web.FormBuilder( web.url_for(controller='page', action='edit', id=encoded_id ), "Edit page attributes", submit_text="Submit" ) .add_text( "page_title", "Page title", value=page_title, error=page_title_err ) .add_text( "page_slug", "Page identifier", value=page_slug, error=page_slug_err, help="""A unique identifier that will be used for @@ -656,7 +656,7 @@ if self.create_item_slug( trans.sa_session, page ): trans.sa_session.flush() - return_dict = { "name" : page.title, "link" : url_for( action="display_by_username_and_slug", username=page.user.username, slug=page.slug ) } + return_dict = { "name" : page.title, "link" : url_for(controller='page', action="display_by_username_and_slug", username=page.user.username, slug=page.slug ) } return return_dict @web.expose diff -r 7db12eb10dbb5f1857f27cab4cdefd7e86b892e1 -r 022fd520c8ec2eee6221c44213c034be504735b8 lib/galaxy/webapps/galaxy/controllers/root.py --- a/lib/galaxy/webapps/galaxy/controllers/root.py +++ b/lib/galaxy/webapps/galaxy/controllers/root.py @@ -418,7 +418,7 @@ return trans.show_warn_message( """ Warning! If you import this history, you will lose your current history. Click <a href="%s">here</a> to confirm. - """ % web.url_for( id=id, confirm=True ) ) + """ % web.url_for( controller='root', action='history_import', id=id, confirm=True ) ) @web.expose def history_new( self, trans, name=None ): trans.new_history( name=name ) diff -r 7db12eb10dbb5f1857f27cab4cdefd7e86b892e1 -r 022fd520c8ec2eee6221c44213c034be504735b8 lib/galaxy/webapps/galaxy/controllers/user.py --- a/lib/galaxy/webapps/galaxy/controllers/user.py +++ b/lib/galaxy/webapps/galaxy/controllers/user.py @@ -443,7 +443,7 @@ if not user and trans.app.config.require_login: if trans.app.config.allow_user_creation: create_account_str = " If you don't already have an account, <a href='%s'>you may create one</a>." % \ - web.url_for( action='create', cntrller='user' ) + web.url_for( controller='user', action='create', cntrller='user' ) if trans.webapp.name == 'galaxy': header = require_login_template % ( "Galaxy instance", create_account_str ) else: @@ -912,7 +912,7 @@ trans.sa_session.add( reset_user ) trans.sa_session.flush() trans.log_event( "User reset password: %s" % email ) - message = "Password has been reset and emailed to: %s. <a href='%s'>Click here</a> to return to the login form." % ( email, web.url_for( action='login' ) ) + message = "Password has been reset and emailed to: %s. <a href='%s'>Click here</a> to return to the login form." % ( email, web.url_for( controller='user', action='login' ) ) except Exception, e: message = 'Failed to reset password: %s' % str( e ) status = 'error' diff -r 7db12eb10dbb5f1857f27cab4cdefd7e86b892e1 -r 022fd520c8ec2eee6221c44213c034be504735b8 lib/galaxy/webapps/galaxy/controllers/visualization.py --- a/lib/galaxy/webapps/galaxy/controllers/visualization.py +++ b/lib/galaxy/webapps/galaxy/controllers/visualization.py @@ -4,7 +4,7 @@ from galaxy import model, web from galaxy.model.item_attrs import UsesAnnotations, UsesItemRatings from galaxy.web.base.controller import BaseUIController, SharableMixin, UsesVisualizationMixin -from galaxy.web.framework.helpers import time_ago, grids, iff +from galaxy.web.framework.helpers import time_ago, grids from galaxy import util from galaxy.util.json import from_json_string from galaxy.util.sanitize_html import sanitize_html @@ -503,7 +503,7 @@ self.create_item_slug( session, visualization ) session.flush() trans.set_message( "Visualization '%s' shared with user '%s'" % ( visualization.title, other.email ) ) - return trans.response.send_redirect( url_for( action='sharing', id=id ) ) + return trans.response.send_redirect( url_for(controller='visualization', action='sharing', id=id ) ) return trans.fill_template( "/ind_share_base.mako", message = msg, messagetype = mtype, @@ -551,7 +551,7 @@ if self.create_item_slug( trans.sa_session, visualization ): trans.sa_session.flush() - return_dict = { "name" : visualization.title, "link" : url_for( action="display_by_username_and_slug", username=visualization.user.username, slug=visualization.slug ) } + return_dict = { "name" : visualization.title, "link" : url_for(controller='visualization', action="display_by_username_and_slug", username=visualization.user.username, slug=visualization.slug ) } return return_dict @web.expose @@ -588,11 +588,11 @@ visualization_slug_err = rval[ 'slug_err' ] else: # Successfully created viz. - return trans.response.send_redirect( web.url_for( action='list' ) ) + return trans.response.send_redirect( web.url_for(controller='visualization', action='list' ) ) viz_type_options = [ ( t, t ) for t in self.viz_types ] return trans.show_form( - web.FormBuilder( web.url_for(), "Create new visualization", submit_text="Submit" ) + web.FormBuilder( web.url_for(controller='visualization', action='create'), "Create new visualization", submit_text="Submit" ) .add_text( "visualization_title", "Visualization title", value=visualization_title, error=visualization_title_err ) .add_select( "visualization_type", "Type", options=viz_type_options, error=None ) .add_text( "visualization_slug", "Visualization identifier", value=visualization_slug, error=visualization_slug_err, @@ -649,7 +649,7 @@ self.add_item_annotation( trans.sa_session, trans.get_user(), visualization, visualization_annotation ) session.flush() # Redirect to visualization list. - return trans.response.send_redirect( web.url_for( action='list' ) ) + return trans.response.send_redirect( web.url_for(controller='visualization', action='list' ) ) else: visualization_title = visualization.title # Create slug if it's not already set. @@ -660,7 +660,7 @@ if not visualization_annotation: visualization_annotation = "" return trans.show_form( - web.FormBuilder( web.url_for( id=id ), "Edit visualization attributes", submit_text="Submit" ) + web.FormBuilder( web.url_for(controller='visualization', action='edit', id=id ), "Edit visualization attributes", submit_text="Submit" ) .add_text( "visualization_title", "Visualization title", value=visualization_title, error=visualization_title_err ) .add_text( "visualization_slug", "Visualization identifier", value=visualization_slug, error=visualization_slug_err, help="""A unique identifier that will be used for diff -r 7db12eb10dbb5f1857f27cab4cdefd7e86b892e1 -r 022fd520c8ec2eee6221c44213c034be504735b8 lib/galaxy/webapps/galaxy/controllers/workflow.py --- a/lib/galaxy/webapps/galaxy/controllers/workflow.py +++ b/lib/galaxy/webapps/galaxy/controllers/workflow.py @@ -113,6 +113,7 @@ @web.expose def index( self, trans ): + print trans.request.host_url return self.list( trans ) @web.expose @@ -410,7 +411,7 @@ #message = "Workflow renamed to '%s'." % new_name #return self.list_grid( trans, message=message, status='done' ) else: - return form( url_for( action='rename', id=trans.security.encode_id(stored.id) ), + return form( url_for(controller='workflow', action='rename', id=trans.security.encode_id(stored.id) ), "Rename workflow", submit_text="Rename", use_panels=True ) \ .add_text( "new_name", "Workflow Name", value=to_unicode( stored.name ) ) @@ -485,7 +486,7 @@ if self.create_item_slug( trans.sa_session, stored ): trans.sa_session.flush() - return_dict = { "name" : stored.name, "link" : url_for( action="display_by_username_and_slug", username=stored.user.username, slug=stored.slug ) } + return_dict = { "name" : stored.name, "link" : url_for(controller='workflow', action="display_by_username_and_slug", username=stored.user.username, slug=stored.slug ) } return return_dict @web.expose @@ -559,7 +560,7 @@ trans.set_message( "Workflow '%s' created" % stored_workflow.name ) return self.list( trans ) else: - return form( url_for(), "Create New Workflow", submit_text="Create", use_panels=True ) \ + return form( url_for(controller="workflow", action="create"), "Create New Workflow", submit_text="Create", use_panels=True ) \ .add_text( "workflow_name", "Workflow Name", value="Unnamed workflow" ) \ .add_text( "workflow_annotation", "Workflow Annotation", value="", help="A description of the workflow; annotation is shown alongside shared or published workflows." ) @@ -910,7 +911,7 @@ pass # Provide user feedback. - workflow_list_str = " <br>Return to <a href='%s'>workflow list." % url_for( action='list' ) + workflow_list_str = " <br>Return to <a href='%s'>workflow list." % url_for( controller='workflow', action='list' ) if response.status != 200: return trans.show_error_message( "There was a problem importing the workflow. Error: %s %s" % (response_data, workflow_list_str) ) if workflow.has_errors: @@ -968,7 +969,7 @@ parser = SingleTagContentsParser( 'id' ) parser.feed( response_data ) myexp_workflow_id = parser.tag_content - workflow_list_str = " <br>Return to <a href='%s'>workflow list." % url_for( action='list' ) + workflow_list_str = " <br>Return to <a href='%s'>workflow list." % url_for( controller='workflow', action='list' ) if myexp_workflow_id: return trans.show_message( \ """Workflow '%s' successfully exported to myExperiment. <br/> @@ -1299,7 +1300,7 @@ # Index page with message return trans.show_message( "Workflow '%s' created from current history." % workflow_name ) ## return trans.show_ok_message( "<p>Workflow '%s' created.</p><p><a target='_top' href='%s'>Click to load in workflow editor</a></p>" - ## % ( workflow_name, web.url_for( action='editor', id=trans.security.encode_id(stored.id) ) ) ) + ## % ( workflow_name, web.url_for(controller='workflow', action='editor', id=trans.security.encode_id(stored.id) ) ) ) @web.expose def run( self, trans, id, history_id=None, multiple_input_mode="product", hide_fixed_params=False, **kwargs ): 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