From e43a425d750179739d46f5514fac35fcc712a25d Mon Sep 17 00:00:00 2001 From: Greg Von Kuster Date: Fri, 10 Jul 2009 16:15:32 -0400 Subject: [PATCH] Fix for tool frame refresh when require_login config setting is true ( resolves ticket 100 ), eliminate center instead of end of history item name in DataToolParameter if name is > 30 chars ( resolves ticket # 64 ), and a log an error instead of raising an exception in get_history() if None is returned ( better behavior ). --- lib/galaxy/tools/parameters/basic.py | 8 ++++++-- lib/galaxy/web/controllers/user.py | 4 ++-- lib/galaxy/web/framework/__init__.py | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index 2459ad994ce..22926fd3eba 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -1115,6 +1115,10 @@ class DataToolParameter( ToolParameter ): # CRUCIAL: the dataset_collector function needs to be local to DataToolParameter.get_html_field() def dataset_collector( hdas, parent_hid ): for i, hda in enumerate( hdas ): + if len( hda.name ) > 30: + hda_name = '%s..%s' % ( hda.name[:17], hda.name[-11:] ) + else: + hda_name = hda.name if parent_hid is not None: hid = "%s.%d" % ( parent_hid, i + 1 ) else: @@ -1132,7 +1136,7 @@ class DataToolParameter( ToolParameter ): continue if isinstance( hda.datatype, self.formats): selected = ( value and ( hda in value ) ) - field.add_option( "%s: %s" % ( hid, hda.name[:30] ), hda.id, selected ) + field.add_option( "%s: %s" % ( hid, hda_name ), hda.id, selected ) else: target_ext, converted_dataset = hda.find_conversion_destination( self.formats, converter_safe = self.converter_safe( other_values, trans ) ) if target_ext: @@ -1141,7 +1145,7 @@ class DataToolParameter( ToolParameter ): if not trans.app.security_agent.allow_action( trans.user, trans.app.security_agent.permitted_actions.DATASET_ACCESS, dataset=hda.dataset ): continue selected = ( value and ( hda in value ) ) - field.add_option( "%s: (as %s) %s" % ( hid, target_ext, hda.name[:30] ), hda.id, selected ) + field.add_option( "%s: (as %s) %s" % ( hid, target_ext, hda_name ), hda.id, selected ) # Also collect children via association object dataset_collector( hda.children, hid ) dataset_collector( history.active_datasets, None ) diff --git a/lib/galaxy/web/controllers/user.py b/lib/galaxy/web/controllers/user.py index 3b62573fb0d..42b6b1faefc 100644 --- a/lib/galaxy/web/controllers/user.py +++ b/lib/galaxy/web/controllers/user.py @@ -168,8 +168,8 @@ class User( BaseController ): mail = os.popen("%s -t" % trans.app.config.sendmail_path, 'w') mail.write("To: %s\nFrom: %s\nSubject: Join Mailing List\n\nJoin Mailing list." % (trans.app.config.mailing_join_addr,email) ) if mail.close(): - return trans.show_warn_message( "Now logged in as " + user.email+". However, subscribing to the mailing list has failed.", refresh_frames=['masthead', 'history'] ) - return trans.show_ok_message( "Now logged in as " + user.email, refresh_frames=['masthead', 'history'] ) + return trans.show_warn_message( "Now logged in as " + user.email+". However, subscribing to the mailing list has failed.", refresh_frames=refresh_frames ) + return trans.show_ok_message( "Now logged in as " + user.email, refresh_frames=refresh_frames ) return trans.show_form( web.FormBuilder( web.url_for(), "Create account", submit_text="Create" ) .add_text( "email", "Email address", value=email, error=email_error ) diff --git a/lib/galaxy/web/framework/__init__.py b/lib/galaxy/web/framework/__init__.py index f51a11bf5d9..d168f0f1e22 100644 --- a/lib/galaxy/web/framework/__init__.py +++ b/lib/galaxy/web/framework/__init__.py @@ -456,7 +456,9 @@ class UniverseWebTransaction( base.DefaultWebTransaction ): if util.string_as_bool( create ): history = self.new_history() else: - raise "get_history() returning None" + # Perhaps a bot is running a tool without having logged in to get a history + log.debug( "Error: this request returned None from get_history(): %s" % self.request.browser_url ) + return None return history def set_history( self, history ): if history and not history.deleted: