commit/galaxy-central: dan: Add require_login and display_interface flags to tools. Add 'everything' target for refresh_frame.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/a2cd73dd4f72/ changeset: a2cd73dd4f72 user: dan date: 2012-03-29 16:24:15 summary: Add require_login and display_interface flags to tools. Add 'everything' target for refresh_frame. affected #: 3 files diff -r 5aab033197616ac6d8ca1f14f672f9f3195a56dc -r a2cd73dd4f7284b1d0ffa56235e478d013cc116f lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -636,6 +636,8 @@ self.check_values = True self.nginx_upload = False self.input_required = False + self.display_interface = True + self.require_login = False # Define a place to keep track of all input parameters. These # differ from the inputs dictionary in that inputs can be page # elements like conditionals, but input_params are basic form @@ -732,6 +734,8 @@ # Useful i.e. when an indeterminate number of outputs are created by # a tool. self.force_history_refresh = util.string_as_bool( root.get( 'force_history_refresh', 'False' ) ) + self.display_interface = util.string_as_bool( root.get( 'display_interface', str( self.display_interface ) ) ) + self.require_login = util.string_as_bool( root.get( 'require_login', str( self.require_login ) ) ) # Load input translator, used by datasource tools to change # names/values of incoming parameters self.input_translator = root.find( "request_param_translation" ) @@ -1337,6 +1341,8 @@ # on the standard run form) or "URL" (a parameter provided by # external data source tools). if "runtool_btn" not in incoming and "URL" not in incoming: + if not self.display_interface: + return 'message.mako', dict( status='info', message="The interface for this tool cannot be displayed", refresh_frames=['everything'] ) return "tool_form.mako", dict( errors={}, tool_state=state, param_values={}, incoming={} ) # Process incoming data if not( self.check_values ): @@ -1385,6 +1391,8 @@ state.page += 1 # Fill in the default values for the next page self.fill_in_new_state( trans, self.inputs_by_page[ state.page ], state.inputs ) + if not self.display_interface: + return 'message.mako', dict( status='info', message="The interface for this tool cannot be displayed", refresh_frames=['everything'] ) return 'tool_form.mako', dict( errors=errors, tool_state=state ) else: try: @@ -1397,6 +1405,8 @@ except: pass # Just a refresh, render the form with updated state and errors. + if not self.display_interface: + return 'message.mako', dict( status='info', message="The interface for this tool cannot be displayed", refresh_frames=['everything'] ) return 'tool_form.mako', dict( errors=errors, tool_state=state ) def find_fieldstorage( self, x ): if isinstance( x, FieldStorage ): diff -r 5aab033197616ac6d8ca1f14f672f9f3195a56dc -r a2cd73dd4f7284b1d0ffa56235e478d013cc116f lib/galaxy/web/controllers/tool_runner.py --- a/lib/galaxy/web/controllers/tool_runner.py +++ b/lib/galaxy/web/controllers/tool_runner.py @@ -58,6 +58,8 @@ log.error( "index called with tool id '%s' but no such tool exists", tool_id ) trans.log_event( "Tool id '%s' does not exist" % tool_id ) return "Tool '%s' does not exist, kwd=%s " % (tool_id, kwd) + if tool.require_login and not trans.user: + return trans.response.send_redirect( url_for( controller='user', action='login', cntrller='user', message="You must be logged in to use this tool.", status="info", referer=url_for( controller='/tool_runner', action='index', tool_id=tool_id, **kwd ) ) ) params = util.Params( kwd, sanitize = False ) #Sanitize parameters when substituting into command line via input wrappers #do param translation here, used by datasource tools if tool.input_translator: diff -r 5aab033197616ac6d8ca1f14f672f9f3195a56dc -r a2cd73dd4f7284b1d0ffa56235e478d013cc116f templates/message.mako --- a/templates/message.mako +++ b/templates/message.mako @@ -24,6 +24,9 @@ <%def name="javascripts()"> ${parent.javascripts()} <script type="text/javascript"> + %if 'everything' in refresh_frames: + parent.location.href="${h.url_for( controller='root' )}"; + %endif %if 'masthead' in refresh_frames: ## if ( parent.frames && parent.frames.galaxy_masthead ) { ## parent.frames.galaxy_masthead.location.href="${h.url_for( controller='root', action='masthead')}"; 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