commit/galaxy-central: greg: A bit of messaging cleanup in the tool shed.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/36ab5b39b985/ changeset: 36ab5b39b985 user: greg date: 2013-02-18 16:01:40 summary: A bit of messaging cleanup in the tool shed. affected #: 3 files diff -r 131f63d242216522ffb06cada3684fbf93fe9254 -r 36ab5b39b985d84d02b449eeaa4876ad73190317 lib/galaxy/util/shed_util_common.py --- a/lib/galaxy/util/shed_util_common.py +++ b/lib/galaxy/util/shed_util_common.py @@ -1166,6 +1166,33 @@ else: valid_tool_dependencies_dict[ 'set_environment' ] = [ requirements_dict ] return valid_tool_dependencies_dict +def generate_message_for_invalid_repository_dependencies( metadata_dict ): + """Return the error message associated with an invalid repository dependency for display in the caller.""" + message = '' + if metadata_dict: + invalid_repository_dependencies_dict = metadata_dict.get( 'invalid_repository_dependencies', None ) + if invalid_repository_dependencies_dict: + invalid_repository_dependencies = invalid_repository_dependencies_dict[ 'invalid_repository_dependencies' ] + for repository_dependency_tup in invalid_repository_dependencies: + toolshed, name, owner, changeset_revision, error = repository_dependency_tup + if error: + message = '%s ' % str( error ) + return message +def generate_message_for_invalid_tool_dependencies( metadata_dict ): + """ + Due to support for orphan tool dependencies (which are always valid) tool dependency definitions can only be invalid if they include a definition for a complex + repository dependency and the repository dependency definition is invalid. This method retrieves the error message associated with the invalid tool dependency + for display in the caller. + """ + message = '' + if metadata_dict: + invalid_tool_dependencies = metadata_dict.get( 'invalid_tool_dependencies', None ) + if invalid_tool_dependencies: + for td_key, requirement_dict in invalid_tool_dependencies.items(): + error = requirement_dict.get( 'error', None ) + if error: + message = '%s ' % str( error ) + return message def generate_message_for_invalid_tools( trans, invalid_file_tups, repository, metadata_dict, as_html=True, displaying_invalid_tool=False ): if as_html: new_line = '<br/>' @@ -1211,7 +1238,6 @@ is considered valid but perhaps an orphan due to it's actual invalidity. """ message = '' - status = 'done' if metadata_dict: orphan_tool_dependencies = metadata_dict.get( 'orphan_tool_dependencies', None ) if orphan_tool_dependencies: @@ -1237,8 +1263,7 @@ version = requirements_dict[ 'version' ] message += "<b>* name:</b> %s, <b>type:</b> %s, <b>version:</b> %s<br/>" % ( str( name ), str( type ), str( version ) ) message += "<br/>" - status = 'warning' - return message, status + return message def generate_metadata_for_changeset_revision( app, repository, changeset_revision, repository_clone_url, shed_config_dict=None, relative_install_dir=None, repository_files_dir=None, resetting_all_metadata_on_repository=False, updating_installed_repository=False, persist=False ): diff -r 131f63d242216522ffb06cada3684fbf93fe9254 -r 36ab5b39b985d84d02b449eeaa4876ad73190317 lib/galaxy/webapps/community/controllers/repository.py --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -2000,10 +2000,11 @@ key_rd_dicts_to_be_processed=None, all_repository_dependencies=None, handled_key_rd_dicts=None ) - if metadata: - if 'orphan_tool_dependencies' in metadata: - orphan_message, status = suc.generate_message_for_orphan_tool_dependencies( metadata ) - message += orphan_message + # Handle messaging for orphan tool dependencies. + orphan_message = suc.generate_message_for_orphan_tool_dependencies( metadata ) + if orphan_message: + message += orphan_message + status = 'warning' if is_malicious: if trans.app.security_agent.can_push( trans.app, trans.user, repository ): message += malicious_error_can_push @@ -2752,10 +2753,11 @@ key_rd_dicts_to_be_processed=None, all_repository_dependencies=None, handled_key_rd_dicts=None ) - if metadata: - if 'orphan_tool_dependencies' in metadata: - orphan_message, status = suc.generate_message_for_orphan_tool_dependencies( metadata ) - message += orphan_message + # Handle messaging for orphan tool dependencies. + orphan_message = suc.generate_message_for_orphan_tool_dependencies( metadata ) + if orphan_message: + message += orphan_message + status = 'warning' else: repository_metadata_id = None metadata = None diff -r 131f63d242216522ffb06cada3684fbf93fe9254 -r 36ab5b39b985d84d02b449eeaa4876ad73190317 lib/galaxy/webapps/community/controllers/upload.py --- a/lib/galaxy/webapps/community/controllers/upload.py +++ b/lib/galaxy/webapps/community/controllers/upload.py @@ -167,33 +167,29 @@ message += " %d files were removed from the repository root. " % len( files_to_remove ) kwd[ 'message' ] = message suc.set_repository_metadata_due_to_new_tip( trans, repository, content_alert_str=content_alert_str, **kwd ) - # Provide a warning message if a tool_dependencies.xml file is provided, but tool dependencies weren't loaded due to a requirement tag mismatch - # or some other problem. if repository.metadata_revisions: # A repository's metadata revisions are order descending by update_time, so the zeroth revision will be the tip just after an upload. metadata_dict = repository.metadata_revisions[0].metadata else: metadata_dict = {} + # Provide a warning message if a tool_dependencies.xml file is provided, but tool dependencies weren't loaded due to a requirement tag mismatch + # or some other problem. Tool dependency definitions can define orphan tool dependencies (no relationship to any tools contained in the repository), + # so warning messages are important because orphans are always valid. The repository owner must be warned in case they did not intend to define an + # orphan dependency, but simply provided incorrect information (tool shed, name owner, changeset_revision) for the definition. # Handle messaging for orphan tool dependencies. - orphan_message, status = suc.generate_message_for_orphan_tool_dependencies( metadata_dict ) + orphan_message = suc.generate_message_for_orphan_tool_dependencies( metadata_dict ) if orphan_message: message += orphan_message - # Display message for invalid tool sependencies. - invalid_tool_dependencies = metadata_dict.get( 'invalid_tool_dependencies', None ) - if invalid_tool_dependencies: - for td_key, requirement_dict in invalid_tool_dependencies.items(): - error = requirement_dict.get( 'error', None ) - if error: - message = "%s %s" % ( message, str( error ) ) + status = 'warning' + # Handle messaging for invalid tool dependencies. + invalid_tool_dependencies_message = suc.generate_message_for_invalid_tool_dependencies( metadata_dict ) + if invalid_tool_dependencies_message: + message += invalid_tool_dependencies_message status = 'error' - # Display message for invalid repository dependencies. - invalid_repository_dependencies_dict = metadata_dict.get( 'invalid_repository_dependencies', None ) - if invalid_repository_dependencies_dict: - invalid_repository_dependencies = invalid_repository_dependencies_dict[ 'invalid_repository_dependencies' ] - for repository_dependency_tup in invalid_repository_dependencies: - toolshed, name, owner, changeset_revision, error = repository_dependency_tup - if error: - message += "%s %s" % ( message, str( error ) ) + # Handle messaging for invalid repository dependencies. + invalid_repository_dependencies_message = suc.generate_message_for_invalid_repository_dependencies( metadata_dict ) + if invalid_repository_dependencies_message: + message += invalid_repository_dependencies_message status = 'error' # Reset the tool_data_tables by loading the empty tool_data_table_conf.xml file. suc.reset_tool_data_tables( trans.app ) 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