From aba34eecda840d6f468dfe8ec3031ccf0353dce3 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Mon, 16 May 2016 13:10:59 -0400 Subject: [PATCH] Update to 'new' except style. --- lib/galaxy/config.py | 4 +- lib/galaxy/datatypes/binary.py | 4 +- lib/galaxy/datatypes/molecules.py | 8 +- lib/galaxy/jobs/__init__.py | 10 +- lib/galaxy/jobs/actions/post.py | 2 +- lib/galaxy/jobs/deferred/__init__.py | 4 +- lib/galaxy/jobs/deferred/data_transfer.py | 4 +- lib/galaxy/jobs/handler.py | 6 +- lib/galaxy/jobs/mapper.py | 2 +- lib/galaxy/jobs/splitters/multi.py | 2 +- lib/galaxy/jobs/transfer_manager.py | 2 +- lib/galaxy/managers/base.py | 2 +- lib/galaxy/managers/folders.py | 2 +- lib/galaxy/managers/libraries.py | 2 +- lib/galaxy/managers/roles.py | 2 +- lib/galaxy/managers/users.py | 2 +- lib/galaxy/model/__init__.py | 12 +-- .../versions/0003_security_and_libraries.py | 94 +++++++++---------- .../versions/0004_indexes_and_defaults.py | 10 +- .../versions/0005_cleanup_datasets_fix.py | 4 +- .../versions/0006_change_qual_datatype.py | 8 +- .../versions/0007_sharing_histories.py | 8 +- .../migrate/versions/0008_galaxy_forms.py | 34 +++---- .../migrate/versions/0009_request_table.py | 4 +- .../0010_hda_display_at_authz_table.py | 4 +- .../versions/0011_v0010_mysql_index_fix.py | 4 +- .../migrate/versions/0012_user_address.py | 4 +- ...0013_change_lib_item_templates_to_forms.py | 36 +++---- .../model/migrate/versions/0014_pages.py | 2 +- .../model/migrate/versions/0015_tagging.py | 16 ++-- .../versions/0016_v0015_mysql_index_fix.py | 4 +- .../versions/0017_library_item_indexes.py | 6 +- .../0018_ordered_tags_and_page_tags.py | 12 +-- .../versions/0019_request_library_folder.py | 8 +- .../versions/0020_library_upload_job.py | 14 +-- .../model/migrate/versions/0021_user_prefs.py | 4 +- .../model/migrate/versions/0025_user_info.py | 4 +- .../migrate/versions/0027_request_events.py | 4 +- .../0028_external_metadata_file_override.py | 2 +- .../migrate/versions/0029_user_actions.py | 4 +- .../0031_community_and_workflow_tags.py | 26 ++--- ...lished_cols_for_histories_and_workflows.py | 12 +-- .../0034_page_user_share_association.py | 4 +- ...item_annotations_and_workflow_step_tags.py | 22 ++--- ...column_to_library_template_assoc_tables.py | 6 +- .../migrate/versions/0037_samples_library.py | 16 ++-- ...column_to_library_template_assoc_tables.py | 6 +- .../migrate/versions/0040_page_annotations.py | 4 +- ...isualization_sharing_tagging_annotating.py | 32 +++---- .../0045_request_type_permissions_table.py | 2 +- .../versions/0047_job_table_user_id_column.py | 8 +- .../0048_dataset_instance_state_column.py | 4 +- .../migrate/versions/0049_api_keys_table.py | 4 +- .../versions/0050_drop_cloud_tables.py | 2 +- .../0051_imported_col_for_jobs_table.py | 4 +- .../versions/0052_sample_dataset_table.py | 4 +- .../migrate/versions/0053_item_ratings.py | 22 ++--- .../versions/0055_add_pja_assoc_for_jobs.py | 4 +- .../migrate/versions/0057_request_notify.py | 4 +- .../versions/0058_history_import_export.py | 4 +- .../versions/0059_sample_dataset_file_path.py | 4 +- .../versions/0060_history_archive_import.py | 8 +- .../versions/0062_user_openid_table.py | 6 +- .../migrate/versions/0063_sequencer_table.py | 4 +- ...d_run_and_sample_run_association_tables.py | 12 +-- ...0065_add_name_to_form_fields_and_values.py | 8 +- ...66_deferred_job_and_transfer_job_tables.py | 8 +- .../versions/0067_populate_sequencer_table.py | 8 +- ...8_rename_sequencer_to_external_services.py | 26 ++--- ...0_add_info_column_to_deferred_job_table.py | 4 +- ...0071_add_history_and_workflow_to_sample.py | 6 +- ...nd_socket_columns_to_transfer_job_table.py | 4 +- ...3_add_ldda_to_implicit_conversion_table.py | 4 +- ..._purged_column_to_library_dataset_table.py | 6 +- .../0075_add_subindex_column_to_run_table.py | 4 +- .../0077_create_tool_tag_association_table.py | 4 +- ...8_add_columns_for_disk_usage_accounting.py | 16 ++-- .../0079_input_library_to_job_table.py | 4 +- .../migrate/versions/0080_quota_tables.py | 16 ++-- .../0081_add_tool_version_to_hda_ldda.py | 4 +- .../0082_add_tool_shed_repository_table.py | 4 +- .../0083_add_prepare_files_to_task.py | 12 +-- ...dd_ldda_id_to_implicit_conversion_table.py | 4 +- .../migrate/versions/0085_add_task_info.py | 4 +- ..._add_tool_shed_repository_table_columns.py | 12 +-- .../versions/0087_tool_id_guid_map_table.py | 4 +- ..._add_installed_changeset_revison_column.py | 4 +- .../0089_add_object_store_id_columns.py | 4 +- ..._add_tool_shed_repository_table_columns.py | 8 +- .../versions/0091_add_tool_version_tables.py | 12 +-- .../versions/0092_add_migrate_tools_table.py | 4 +- .../versions/0093_add_job_params_col.py | 4 +- .../versions/0094_add_job_handler_col.py | 4 +- .../migrate/versions/0095_hda_subsets.py | 6 +- .../migrate/versions/0096_openid_provider.py | 6 +- .../versions/0097_add_ctx_rev_column.py | 4 +- .../0098_genome_index_tool_data_table.py | 4 +- .../0099_add_tool_dependency_table.py | 4 +- ...er_tool_dependency_table_version_column.py | 2 +- ...rop_installed_changeset_revision_column.py | 2 +- ...0102_add_tool_dependency_status_columns.py | 12 +-- ...add_tool_shed_repository_status_columns.py | 14 +-- .../versions/0105_add_cleanup_event_table.py | 4 +- .../versions/0106_add_missing_indexes.py | 4 +- .../0107_add_exit_code_to_job_and_task.py | 8 +- .../versions/0108_add_extended_metadata.py | 8 +- .../0109_add_repository_dependency_tables.py | 8 +- .../migrate/versions/0110_add_dataset_uuid.py | 4 +- .../versions/0111_add_job_destinations.py | 8 +- ...and_data_manager_job_association_tables.py | 8 +- .../0113_update_migrate_tools_table.py | 4 +- .../0114_update_migrate_tools_table_again.py | 4 +- ..._available_col_add_tool_shed_status_col.py | 8 +- .../versions/0117_add_user_activation.py | 4 +- .../0118_add_hda_extended_metadata.py | 4 +- .../migrate/versions/0121_workflow_uuids.py | 4 +- .../0123_add_workflow_request_tables.py | 2 +- lib/galaxy/openid/providers.py | 4 +- lib/galaxy/security/__init__.py | 2 +- lib/galaxy/tools/__init__.py | 18 ++-- lib/galaxy/tools/actions/__init__.py | 4 +- lib/galaxy/tools/actions/upload_common.py | 2 +- lib/galaxy/tools/data/__init__.py | 8 +- lib/galaxy/tools/data_manager/manager.py | 10 +- lib/galaxy/tools/evaluation.py | 8 +- lib/galaxy/tools/imp_exp/__init__.py | 6 +- lib/galaxy/tools/imp_exp/export_history.py | 2 +- .../tools/imp_exp/unpack_tar_gz_archive.py | 4 +- lib/galaxy/tools/parameters/__init__.py | 2 +- lib/galaxy/tools/parameters/basic.py | 8 +- lib/galaxy/tools/parameters/grouping.py | 6 +- lib/galaxy/tools/parameters/sanitize.py | 2 +- lib/galaxy/tools/test.py | 2 +- lib/galaxy/tools/util/maf_utilities.py | 8 +- lib/galaxy/visualization/genomes.py | 2 +- .../visualization/plugins/resource_parser.py | 4 +- lib/galaxy/web/base/controller.py | 4 +- lib/galaxy/web/framework/base.py | 2 +- lib/galaxy/web/framework/webapp.py | 8 +- lib/galaxy/web/proxy/__init__.py | 18 ++-- .../webapps/galaxy/api/folder_contents.py | 2 +- lib/galaxy/webapps/galaxy/api/group_roles.py | 8 +- lib/galaxy/webapps/galaxy/api/group_users.py | 8 +- .../webapps/galaxy/api/history_contents.py | 2 +- .../webapps/galaxy/api/library_contents.py | 10 +- lib/galaxy/webapps/galaxy/api/quotas.py | 12 +-- lib/galaxy/webapps/galaxy/api/remote_files.py | 10 +- lib/galaxy/webapps/galaxy/api/search.py | 4 +- .../galaxy/api/tool_shed_repositories.py | 4 +- .../webapps/galaxy/api/visualizations.py | 2 +- lib/galaxy/webapps/galaxy/api/workflows.py | 2 +- .../webapps/galaxy/controllers/admin.py | 8 +- .../galaxy/controllers/admin_toolshed.py | 6 +- .../webapps/galaxy/controllers/async.py | 2 +- .../webapps/galaxy/controllers/biostar.py | 6 +- .../galaxy/controllers/data_manager.py | 4 +- .../webapps/galaxy/controllers/dataset.py | 14 +-- .../webapps/galaxy/controllers/history.py | 10 +- .../galaxy/controllers/library_common.py | 6 +- .../galaxy/controllers/requests_common.py | 2 +- .../webapps/galaxy/controllers/tool_runner.py | 2 +- lib/galaxy/webapps/galaxy/controllers/user.py | 4 +- .../galaxy/controllers/visualization.py | 4 +- .../webapps/tool_shed/api/repositories.py | 6 +- lib/galaxy/webapps/tool_shed/config.py | 4 +- .../webapps/tool_shed/controllers/upload.py | 6 +- .../versions/0002_add_tool_suite_column.py | 4 +- ...03_review_and_review_association_tables.py | 4 +- .../versions/0004_repository_tables.py | 12 +-- .../versions/0005_drop_tool_related_tables.py | 28 +++--- .../versions/0006_add_email_alerts_column.py | 4 +- ...ng_description_times_downloaded_columns.py | 8 +- .../0008_add_repository_metadata_table.py | 4 +- .../versions/0009_add_malicious_column.py | 4 +- .../0010_add_new_repo_alert_column.py | 4 +- .../versions/0011_add_tool_versions_column.py | 4 +- .../versions/0012_add_downloadable_column.py | 4 +- .../versions/0013_add_review_tables.py | 12 +-- .../versions/0014_add_deprecated_column.py | 4 +- .../versions/0015_add_api_keys_table.py | 4 +- ...ols_functionally_correct_errors_columns.py | 16 ++-- ...ty_columns_to_repository_metadata_table.py | 20 ++-- ...18_add_repository_metadata_flag_columns.py | 12 +-- ...est_table_and_test_install_error_column.py | 8 +- .../0020_add_repository_type_column.py | 4 +- .../0022_add_repository_admin_roles.py | 4 +- ...023_add_repository_url_and_hompeage_url.py | 4 +- .../webapps/tool_shed/util/hgweb_config.py | 4 +- lib/galaxy/workflow/modules.py | 2 +- lib/galaxy_ext/metadata/set_metadata.py | 2 +- lib/galaxy_utils/sequence/fastq.py | 8 +- lib/tool_shed/capsule/capsule_manager.py | 10 +- .../galaxy_install/dependency_display.py | 2 +- .../galaxy_install/install_manager.py | 8 +- .../installed_repository_manager.py | 16 ++-- .../repair_repository_manager.py | 2 +- .../repository_dependency_manager.py | 4 +- .../recipe/env_file_builder.py | 8 +- .../recipe/install_environment.py | 4 +- .../tool_dependencies/recipe/step_handler.py | 4 +- .../tool_dependencies/recipe/tag_handler.py | 4 +- .../galaxy_install/tool_migration_manager.py | 2 +- .../galaxy_install/tools/data_manager.py | 2 +- .../tools/tool_panel_manager.py | 2 +- .../update_repository_manager.py | 2 +- .../utility_containers/__init__.py | 2 +- lib/tool_shed/metadata/metadata_generator.py | 2 +- lib/tool_shed/repository_registry.py | 4 +- lib/tool_shed/tool_shed_registry.py | 2 +- lib/tool_shed/tools/data_table_manager.py | 2 +- lib/tool_shed/tools/tool_validator.py | 4 +- lib/tool_shed/util/basic_util.py | 2 +- lib/tool_shed/util/commit_util.py | 8 +- lib/tool_shed/util/common_util.py | 10 +- lib/tool_shed/util/hg_util.py | 4 +- lib/tool_shed/util/readme_util.py | 6 +- lib/tool_shed/util/shed_util_common.py | 10 +- lib/tool_shed/util/tool_dependency_util.py | 2 +- lib/tool_shed/util/tool_util.py | 2 +- lib/tool_shed/util/xml_util.py | 4 +- lib/tool_shed/utility_containers/__init__.py | 4 +- .../utility_container_manager.py | 16 ++-- 222 files changed, 771 insertions(+), 771 deletions(-) diff --git a/lib/galaxy/config.py b/lib/galaxy/config.py index 54452263c1c..7bc9100f9a9 100644 --- a/lib/galaxy/config.py +++ b/lib/galaxy/config.py @@ -632,7 +632,7 @@ class Configuration( object ): if path not in [ None, False ] and not os.path.isdir( path ): try: os.makedirs( path ) - except Exception, e: + except Exception as e: raise ConfigurationError( "Unable to create missing directory: %s\n%s" % ( path, e ) ) def check( self ): @@ -642,7 +642,7 @@ class Configuration( object ): if path not in [ None, False ] and not os.path.isdir( path ): try: os.makedirs( path ) - except Exception, e: + except Exception as e: raise ConfigurationError( "Unable to create missing directory: %s\n%s" % ( path, e ) ) # Create the directories that it makes sense to create if self.object_store_config_file is None: diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index 7e32f7af6ac..8ed338b77e5 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -958,7 +958,7 @@ class MzSQlite( SQlite ): if table_name not in result: return False return True - except Exception, e: + except Exception as e: log.warn( '%s, sniff Exception: %s', self, e ) return False @@ -993,7 +993,7 @@ class IdpDB( SQlite ): if table_name not in result: return False return True - except Exception, e: + except Exception as e: log.warn( '%s, sniff Exception: %s', self, e ) return False diff --git a/lib/galaxy/datatypes/molecules.py b/lib/galaxy/datatypes/molecules.py index ce66f4b88cb..91258b09634 100644 --- a/lib/galaxy/datatypes/molecules.py +++ b/lib/galaxy/datatypes/molecules.py @@ -154,7 +154,7 @@ class SDF(GenericMolFile): sdf_lines_accumulated = [] if sdf_lines_accumulated: _write_part_sdf_file(sdf_lines_accumulated) - except Exception, e: + except Exception as e: log.error('Unable to split files: %s' % str(e)) raise split = classmethod(split) @@ -236,7 +236,7 @@ class MOL2(GenericMolFile): mol2_lines_accumulated = [] if mol2_lines_accumulated: _write_part_mol2_file(mol2_lines_accumulated) - except Exception, e: + except Exception as e: log.error('Unable to split files: %s' % str(e)) raise split = classmethod(split) @@ -316,7 +316,7 @@ class FPS(GenericMolFile): lines_accumulated = [] if lines_accumulated: _write_part_fingerprint_file(header_lines + lines_accumulated) - except Exception, e: + except Exception as e: log.error('Unable to split files: %s' % str(e)) raise split = classmethod(split) @@ -727,7 +727,7 @@ class CML(GenericXml): cml_lines_accumulated = [] if cml_lines_accumulated: _write_part_cml_file(cml_lines_accumulated) - except Exception, e: + except Exception as e: log.error('Unable to split files: %s' % str(e)) raise split = classmethod(split) diff --git a/lib/galaxy/jobs/__init__.py b/lib/galaxy/jobs/__init__.py index 878421d0ac9..9c2f295b2da 100644 --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -996,7 +996,7 @@ class JobWrapper( object ): try: shutil.move( dataset_path.false_path, dataset_path.real_path ) log.debug( "fail(): Moved %s to %s" % ( dataset_path.false_path, dataset_path.real_path ) ) - except ( IOError, OSError ), e: + except ( IOError, OSError ) as e: log.error( "fail(): Missing output file in working directory: %s" % e ) for dataset_assoc in job.output_datasets + job.output_library_datasets: dataset = dataset_assoc.dataset @@ -1202,7 +1202,7 @@ class JobWrapper( object ): os.stat( dataset.dataset.file_name ) os.chown( dataset.dataset.file_name, os.getuid(), -1 ) trynum = self.app.config.retry_job_output_collection - except ( OSError, ObjectNotFound ), e: + except ( OSError, ObjectNotFound ) as e: trynum += 1 log.warning( 'Error accessing %s, will retry: %s', dataset.dataset.file_name, e ) time.sleep( 2 ) @@ -1388,7 +1388,7 @@ class JobWrapper( object ): # fix permissions for path in [ dp.real_path for dp in self.get_mutable_output_fnames() ]: - util.umask_fix_perms( path, self.app.config.umask, 0666, self.app.config.gid ) + util.umask_fix_perms( path, self.app.config.umask, 0o666, self.app.config.gid ) # Finally set the job state. This should only happen *after* all # dataset creation, and will allow us to eliminate force_history_refresh. @@ -1442,7 +1442,7 @@ class JobWrapper( object ): create=True, preserve_symlinks=True ) - except Exception, e: + except Exception as e: log.debug( "Error in collect_associated_files: %s" % ( e ) ) def _collect_metrics( self, has_metrics ): @@ -1715,7 +1715,7 @@ class JobWrapper( object ): self._change_ownership( self.user_system_pwent[0], str( self.user_system_pwent[3] ) ) except: log.exception( '(%s) Failed to change ownership of %s, making world-writable instead' % ( job.id, self.working_directory ) ) - os.chmod( self.working_directory, 0777 ) + os.chmod( self.working_directory, 0o777 ) def reclaim_ownership( self ): job = self.get_job() diff --git a/lib/galaxy/jobs/actions/post.py b/lib/galaxy/jobs/actions/post.py index b0c1f4698a3..edbdc46445d 100644 --- a/lib/galaxy/jobs/actions/post.py +++ b/lib/galaxy/jobs/actions/post.py @@ -80,7 +80,7 @@ class EmailAction(DefaultJobAction): body = "Your Galaxy job generating dataset '%s' is complete as of %s." % (outdata, datetime.datetime.now().strftime( "%I:%M" )) try: send_mail( frm, to, subject, body, app.config ) - except Exception, e: + except Exception as e: log.error("EmailAction PJA Failed, exception: %s" % e) @classmethod diff --git a/lib/galaxy/jobs/deferred/__init__.py b/lib/galaxy/jobs/deferred/__init__.py index a7077dd653d..1a0087bc6fe 100644 --- a/lib/galaxy/jobs/deferred/__init__.py +++ b/lib/galaxy/jobs/deferred/__init__.py @@ -105,14 +105,14 @@ class DeferredJobQueue( object ): if job.is_check_time: try: job_state = self.plugins[job.plugin].check_job( job ) - except Exception, e: + except Exception as e: self.__fail_job( job ) log.exception( 'Set deferred job %s to error because of an exception in check_job(): %s' % ( job.id, str( e ) ) ) continue if job_state == self.job_states.READY: try: self.plugins[job.plugin].run_job( job ) - except Exception, e: + except Exception as e: self.__fail_job( job ) log.exception( 'Set deferred job %s to error because of an exception in run_job(): %s' % ( job.id, str( e ) ) ) continue diff --git a/lib/galaxy/jobs/deferred/data_transfer.py b/lib/galaxy/jobs/deferred/data_transfer.py index 56875c4e5ef..753ee797640 100644 --- a/lib/galaxy/jobs/deferred/data_transfer.py +++ b/lib/galaxy/jobs/deferred/data_transfer.py @@ -105,7 +105,7 @@ class DataTransfer( object ): tj = self.sa_session.query( self.app.model.TransferJob ).get( int( job.params['transfer_job_id'] ) ) result_dict = tj.params result_dict['local_path'] = tj.path - except Exception, e: + except Exception as e: log.error( "Updated transfer result unavailable, using old result. Error was: %s" % str( e ) ) result_dict = job.params[ 'result' ] library_dataset_name = result_dict[ 'name' ] @@ -151,7 +151,7 @@ class DataTransfer( object ): # TODO: not sure if this flush is necessary self.sa_session.add( ldda ) self.sa_session.flush() - except Exception, e: + except Exception as e: log.exception( 'Failure preparing library dataset for finished transfer job (id: %s) via deferred job (id: %s):' % ( str( job.transfer_job.id ), str( job.id ) ) ) ldda.state = ldda.states.ERROR diff --git a/lib/galaxy/jobs/handler.py b/lib/galaxy/jobs/handler.py index 5cf7359df2c..b408dfd3d3b 100644 --- a/lib/galaxy/jobs/handler.py +++ b/lib/galaxy/jobs/handler.py @@ -364,7 +364,7 @@ class JobHandlerQueue( object ): except JobNotReadyException as e: job_state = e.job_state or JOB_WAIT return job_state, None - except Exception, e: + except Exception as e: failure_message = getattr( e, 'failure_message', DEFAULT_JOB_PUT_FAILURE_MESSAGE ) if failure_message == DEFAULT_JOB_PUT_FAILURE_MESSAGE: log.exception( 'Failed to generate job destination' ) @@ -384,7 +384,7 @@ class JobHandlerQueue( object ): usage = self.app.quota_agent.get_usage( user=job.user, history=job.history ) if usage > quota: return JOB_USER_OVER_QUOTA, job_destination - except AssertionError, e: + except AssertionError as e: pass # No history, should not happen with an anon user return state, job_destination @@ -743,7 +743,7 @@ class DefaultJobDispatcher( object ): runner_name = url.split(':', 1)[0] try: return self.job_runners[runner_name].url_to_destination(url) - except Exception, e: + except Exception as e: log.exception("Unable to convert legacy job runner URL '%s' to job destination, destination will be the '%s' runner with no params: %s" % (url, runner_name, e)) return JobDestination(runner=runner_name) diff --git a/lib/galaxy/jobs/mapper.py b/lib/galaxy/jobs/mapper.py index e0c6b3bdf29..5ccdaa51a29 100644 --- a/lib/galaxy/jobs/mapper.py +++ b/lib/galaxy/jobs/mapper.py @@ -66,7 +66,7 @@ class JobRunnerMapper( object ): for comp in rule_module_name.split( "." )[1:]: module = getattr( module, comp ) modules.append( module ) - except BaseException, exception: + except BaseException as exception: exception_str = str( exception ) message = "%s rule module could not be loaded: %s" % ( rule_module_name, exception_str ) log.debug( message ) diff --git a/lib/galaxy/jobs/splitters/multi.py b/lib/galaxy/jobs/splitters/multi.py index b4988ea4697..4be3b2d0b25 100644 --- a/lib/galaxy/jobs/splitters/multi.py +++ b/lib/galaxy/jobs/splitters/multi.py @@ -178,7 +178,7 @@ def do_merge( job_wrapper, task_wrappers): log_error = "The output '%s' does not define a method for implementing parallelism" % output log.exception(log_error) raise Exception(log_error) - except Exception, e: + except Exception as e: stdout = 'Error merging files' log.exception( stdout ) stderr = str(e) diff --git a/lib/galaxy/jobs/transfer_manager.py b/lib/galaxy/jobs/transfer_manager.py index 71531676ead..ccd5c88e67f 100644 --- a/lib/galaxy/jobs/transfer_manager.py +++ b/lib/galaxy/jobs/transfer_manager.py @@ -102,7 +102,7 @@ class TransferManager( object ): # Request was valid response['result']['transfer_job_id'] = tj.id rval.append( response['result'] ) - except Exception, e: + except Exception as e: # State checking via the transfer daemon failed, just # return the state from the database instead. Callers can # look for the 'error' member of the response to see why diff --git a/lib/galaxy/managers/base.py b/lib/galaxy/managers/base.py index 7d9bec83d20..50dbd4945a6 100644 --- a/lib/galaxy/managers/base.py +++ b/lib/galaxy/managers/base.py @@ -990,7 +990,7 @@ class ModelFilterParser( HasAModelManager ): return orm_filter # by convention, assume most val parsers raise ValueError - except ValueError, val_err: + except ValueError as val_err: raise exceptions.RequestParameterInvalidException( 'unparsable value for filter', column=attr, operation=op, value=val, ValueError=str( val_err ) ) diff --git a/lib/galaxy/managers/folders.py b/lib/galaxy/managers/folders.py index 0f76208be47..cbb4ad3e9b7 100644 --- a/lib/galaxy/managers/folders.py +++ b/lib/galaxy/managers/folders.py @@ -43,7 +43,7 @@ class FolderManager( object ): raise InconsistentDatabase( 'Multiple folders found with the same id.' ) except NoResultFound: raise RequestParameterInvalidException( 'No folder found with the id provided.' ) - except Exception, e: + except Exception as e: raise InternalServerError( 'Error loading from the database.' + str( e ) ) folder = self.secure( trans, folder, check_manageable, check_accessible ) return folder diff --git a/lib/galaxy/managers/libraries.py b/lib/galaxy/managers/libraries.py index 2aeb4d63fe6..3fb32a2cb54 100644 --- a/lib/galaxy/managers/libraries.py +++ b/lib/galaxy/managers/libraries.py @@ -41,7 +41,7 @@ class LibraryManager( object ): raise exceptions.InconsistentDatabase( 'Multiple libraries found with the same id.' ) except NoResultFound: raise exceptions.RequestParameterInvalidException( 'No library found with the id provided.' ) - except Exception, e: + except Exception as e: raise exceptions.InternalServerError( 'Error loading from the database.' + str( e ) ) library = self.secure( trans, library, check_accessible) return library diff --git a/lib/galaxy/managers/roles.py b/lib/galaxy/managers/roles.py index 9e3387948dc..3bd298b723a 100644 --- a/lib/galaxy/managers/roles.py +++ b/lib/galaxy/managers/roles.py @@ -44,6 +44,6 @@ class RoleManager( base.ModelManager ): raise galaxy.exceptions.InconsistentDatabase( 'Multiple roles found with the same id.' ) except sqlalchemy_exceptions.NoResultFound: raise galaxy.exceptions.RequestParameterInvalidException( 'No role found with the id provided.' ) - except Exception, e: + except Exception as e: raise galaxy.exceptions.InternalServerError( 'Error loading from the database.' + str(e) ) return role diff --git a/lib/galaxy/managers/users.py b/lib/galaxy/managers/users.py index 9ebda079bb9..ed53055c07f 100644 --- a/lib/galaxy/managers/users.py +++ b/lib/galaxy/managers/users.py @@ -52,7 +52,7 @@ class UserManager( base.ModelManager, deletable.PurgableManagerMixin ): try: self.session().flush() # TODO:?? flush needed for permissions below? If not, make optional - except sqlalchemy.exc.IntegrityError, db_err: + except sqlalchemy.exc.IntegrityError as db_err: raise exceptions.Conflict( db_err.message ) # can throw an sqlalx.IntegrityError if username not unique diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index eb2d0a24d94..43345b2c747 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -2160,14 +2160,14 @@ class DatasetInstance( object ): if cp_from_ldda: lst.append( (cp_from_ldda, "(Data Library)") ) return _source_dataset_chain( cp_from_ldda, lst ) - except Exception, e: + except Exception as e: log.warning( e ) try: cp_from_hda = dataset.copied_from_history_dataset_association if cp_from_hda: lst.append( (cp_from_hda, cp_from_hda.history.name) ) return _source_dataset_chain( cp_from_hda, lst ) - except Exception, e: + except Exception as e: log.warning( e ) return lst return _source_dataset_chain( self, [] ) @@ -2237,7 +2237,7 @@ class DatasetInstance( object ): converted_dataset = self.get_converted_dataset( trans, target_type ) except NoConverterException: return self.conversion_messages.NO_CONVERTER - except ConverterDependencyException, dep_error: + except ConverterDependencyException as dep_error: return { 'kind': self.conversion_messages.ERROR, 'message': dep_error.value } # Check dataset state and return any messages. @@ -3066,7 +3066,7 @@ class ImplicitlyConvertedDatasetAssociation( object ): self.purged = True try: os.unlink( self.file_name ) - except Exception, e: + except Exception as e: log.error( "Failed to purge associated file (%s) from disk: %s" % ( self.file_name, e ) ) @@ -4109,7 +4109,7 @@ class MetadataFile( StorableObject ): # Create directory if it does not exist try: os.makedirs( path ) - except OSError, e: + except OSError as e: # File Exists is okay, otherwise reraise if e.errno != errno.EEXIST: raise @@ -4408,7 +4408,7 @@ All samples in state: %(sample_state)s try: send_mail( frm, to, subject, body, trans.app.config ) comments = "Email notification sent to %s." % ", ".join( to ).strip().strip( ',' ) - except Exception, e: + except Exception as e: comments = "Email notification failed. (%s)" % str(e) # update the request history with the email notification event elif not trans.app.config.smtp_server: diff --git a/lib/galaxy/model/migrate/versions/0003_security_and_libraries.py b/lib/galaxy/model/migrate/versions/0003_security_and_libraries.py index 8751c26c74a..4bdef1f3a3d 100644 --- a/lib/galaxy/model/migrate/versions/0003_security_and_libraries.py +++ b/lib/galaxy/model/migrate/versions/0003_security_and_libraries.py @@ -344,13 +344,13 @@ def upgrade(migrate_engine): col = Column( 'deleted', Boolean, index=True, default=False ) col.create( User_table, index_name='ix_user_deleted') assert col is User_table.c.deleted - except Exception, e: + except Exception as e: log.debug( "Adding column 'deleted' to galaxy_user table failed: %s" % ( str( e ) ) ) try: col = Column( 'purged', Boolean, index=True, default=False ) col.create( User_table, index_name='ix_user_purged') assert col is User_table.c.purged - except Exception, e: + except Exception as e: log.debug( "Adding column 'purged' to galaxy_user table failed: %s" % ( str( e ) ) ) # Add 1 new column to the history_dataset_association table try: @@ -363,7 +363,7 @@ def upgrade(migrate_engine): col = Column( 'copied_from_library_dataset_dataset_association_id', Integer, nullable=True ) col.create( HistoryDatasetAssociation_table) assert col is HistoryDatasetAssociation_table.c.copied_from_library_dataset_dataset_association_id - except Exception, e: + except Exception as e: log.debug( "Adding column 'copied_from_library_dataset_dataset_association_id' to history_dataset_association table failed: %s" % ( str( e ) ) ) # Add 1 new column to the metadata_file table try: @@ -376,7 +376,7 @@ def upgrade(migrate_engine): col = Column( 'lda_id', Integer, index=True, nullable=True ) col.create( MetadataFile_table, index_name='ix_metadata_file_lda_id') assert col is MetadataFile_table.c.lda_id - except Exception, e: + except Exception as e: log.debug( "Adding column 'lda_id' to metadata_file table failed: %s" % ( str( e ) ) ) # Add 1 new column to the stored_workflow table - changeset 2328 try: @@ -392,7 +392,7 @@ def upgrade(migrate_engine): col = Column( 'importable', Boolean, default=False ) col.create( StoredWorkflow_table ) assert col is StoredWorkflow_table.c.importable - except Exception, e: + except Exception as e: log.debug( "Adding column 'importable' to stored_workflow table failed: %s" % ( str( e ) ) ) # Create an index on the Job.state column - changeset 2192 try: @@ -404,7 +404,7 @@ def upgrade(migrate_engine): try: i = Index( 'ix_job_state', Job_table.c.state ) i.create() - except Exception, e: + except Exception as e: log.debug( "Adding index to job.state column failed: %s" % ( str( e ) ) ) # Add all of the new tables above metadata.create_all() @@ -426,7 +426,7 @@ def upgrade(migrate_engine): name='history_dataset_association_copied_from_library_dataset_da_fkey' ) # Create the constraint cons.create() - except Exception, e: + except Exception as e: log.debug( "Adding foreign key constraint 'history_dataset_association_copied_from_library_dataset_da_fkey' to table 'history_dataset_association' failed: %s" % ( str( e ) ) ) # Add 1 foreign key constraint to the metadata_file table try: @@ -448,7 +448,7 @@ def upgrade(migrate_engine): name='metadata_file_lda_id_fkey' ) # Create the constraint cons.create() - except Exception, e: + except Exception as e: log.debug( "Adding foreign key constraint 'metadata_file_lda_id_fkey' to table 'metadata_file' failed: %s" % ( str( e ) ) ) # Make sure we have at least 1 user cmd = "SELECT * FROM galaxy_user;" @@ -556,7 +556,7 @@ def downgrade(migrate_engine): name='metadata_file_lda_id_fkey' ) # Drop the constraint cons.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping foreign key constraint 'metadata_file_lda_id_fkey' from table 'metadata_file' failed: %s" % ( str( e ) ) ) # Drop 1 foreign key constraint from the history_dataset_association table try: @@ -576,132 +576,132 @@ def downgrade(migrate_engine): name='history_dataset_association_copied_from_library_dataset_da_fkey' ) # Drop the constraint cons.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping foreign key constraint 'history_dataset_association_copied_from_library_dataset_da_fkey' from table 'history_dataset_association' failed: %s" % ( str( e ) ) ) # Drop all of the new tables above try: UserGroupAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping user_group_association table failed: %s" % str( e ) ) try: UserRoleAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping user_role_association table failed: %s" % str( e ) ) try: GroupRoleAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping group_role_association table failed: %s" % str( e ) ) try: Group_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping galaxy_group table failed: %s" % str( e ) ) try: DatasetPermissions_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping dataset_permissions table failed: %s" % str( e ) ) try: LibraryPermissions_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_permissions table failed: %s" % str( e ) ) try: LibraryFolderPermissions_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_folder_permissions table failed: %s" % str( e ) ) try: LibraryDatasetPermissions_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_dataset_permissions table failed: %s" % str( e ) ) try: LibraryDatasetDatasetAssociationPermissions_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_dataset_dataset_association_permissions table failed: %s" % str( e ) ) try: LibraryItemInfoPermissions_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_item_info_permissions table failed: %s" % str( e ) ) try: LibraryItemInfoTemplatePermissions_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_item_info_template_permissions table failed: %s" % str( e ) ) try: DefaultUserPermissions_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping default_user_permissions table failed: %s" % str( e ) ) try: DefaultHistoryPermissions_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping default_history_permissions table failed: %s" % str( e ) ) try: Role_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping role table failed: %s" % str( e ) ) try: LibraryDatasetDatasetInfoAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_dataset_dataset_info_association table failed: %s" % str( e ) ) try: LibraryDataset_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_dataset table failed: %s" % str( e ) ) try: LibraryDatasetDatasetAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_dataset_dataset_association table failed: %s" % str( e ) ) try: LibraryDatasetDatasetInfoTemplateAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_dataset_dataset_info_template_association table failed: %s" % str( e ) ) try: JobExternalOutputMetadata_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping job_external_output_metadata table failed: %s" % str( e ) ) try: Library_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library table failed: %s" % str( e ) ) try: LibraryFolder_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_folder table failed: %s" % str( e ) ) try: LibraryItemInfoTemplateElement_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_item_info_template_element table failed: %s" % str( e ) ) try: LibraryInfoTemplateAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_info_template_association table failed: %s" % str( e ) ) try: LibraryFolderInfoTemplateAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_folder_info_template_association table failed: %s" % str( e ) ) try: LibraryDatasetInfoTemplateAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_dataset_info_template_association table failed: %s" % str( e ) ) try: LibraryInfoAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_info_association table failed: %s" % str( e ) ) try: LibraryFolderInfoAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_folder_info_association table failed: %s" % str( e ) ) try: LibraryDatasetInfoAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_dataset_info_association table failed: %s" % str( e ) ) try: LibraryItemInfoElement_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_item_info_element table failed: %s" % str( e ) ) try: LibraryItemInfo_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_item_info table failed: %s" % str( e ) ) try: LibraryItemInfoTemplate_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_item_info_template table failed: %s" % str( e ) ) # Drop the index on the Job.state column - changeset 2192 try: @@ -713,7 +713,7 @@ def downgrade(migrate_engine): try: i = Index( 'ix_job_state', Job_table.c.state ) i.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping index from job.state column failed: %s" % ( str( e ) ) ) # Drop 1 column from the stored_workflow table - changeset 2328 try: @@ -725,7 +725,7 @@ def downgrade(migrate_engine): try: col = StoredWorkflow_table.c.importable col.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping column 'importable' from stored_workflow table failed: %s" % ( str( e ) ) ) # Drop 1 column from the metadata_file table try: @@ -737,7 +737,7 @@ def downgrade(migrate_engine): try: col = MetadataFile_table.c.lda_id col.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping column 'lda_id' from metadata_file table failed: %s" % ( str( e ) ) ) # Drop 1 column from the history_dataset_association table try: @@ -749,7 +749,7 @@ def downgrade(migrate_engine): try: col = HistoryDatasetAssociation_table.c.copied_from_library_dataset_dataset_association_id col.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping column 'copied_from_library_dataset_dataset_association_id' from history_dataset_association table failed: %s" % ( str( e ) ) ) # Drop 2 columns from the galaxy_user table try: @@ -761,10 +761,10 @@ def downgrade(migrate_engine): try: col = User_table.c.deleted col.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping column 'deleted' from galaxy_user table failed: %s" % ( str( e ) ) ) try: col = User_table.c.purged col.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping column 'purged' from galaxy_user table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0004_indexes_and_defaults.py b/lib/galaxy/model/migrate/versions/0004_indexes_and_defaults.py index 1039c36fad8..8331b9b2e45 100644 --- a/lib/galaxy/model/migrate/versions/0004_indexes_and_defaults.py +++ b/lib/galaxy/model/migrate/versions/0004_indexes_and_defaults.py @@ -32,31 +32,31 @@ def upgrade(migrate_engine): i = Index( 'ix_galaxy_user_deleted', User_table.c.deleted ) try: i.create() - except Exception, e: + except Exception as e: log.debug( "Adding index 'ix_galaxy_user_deleted' to galaxy_user table failed: %s" % ( str( e ) ) ) i = Index( 'ix_galaxy_user_purged', User_table.c.purged ) try: i.create() - except Exception, e: + except Exception as e: log.debug( "Adding index 'ix_galaxy_user_purged' to galaxy_user table failed: %s" % ( str( e ) ) ) # Set the default data in the galaxy_user table, but only for null values cmd = "UPDATE galaxy_user SET deleted = %s WHERE deleted is null" cmd = cmd % boolean_false() try: migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "Setting default data for galaxy_user.deleted column failed: %s" % ( str( e ) ) ) cmd = "UPDATE galaxy_user SET purged = %s WHERE purged is null" cmd = cmd % boolean_false() try: migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "Setting default data for galaxy_user.purged column failed: %s" % ( str( e ) ) ) # Add 1 index to the history_dataset_association table i = Index( 'ix_hda_copied_from_library_dataset_dataset_association_id', HistoryDatasetAssociation_table.c.copied_from_library_dataset_dataset_association_id ) try: i.create() - except Exception, e: + except Exception as e: log.debug( "Adding index 'ix_hda_copied_from_library_dataset_dataset_association_id' to history_dataset_association table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0005_cleanup_datasets_fix.py b/lib/galaxy/model/migrate/versions/0005_cleanup_datasets_fix.py index 9a95525784c..b20e11f5afd 100644 --- a/lib/galaxy/model/migrate/versions/0005_cleanup_datasets_fix.py +++ b/lib/galaxy/model/migrate/versions/0005_cleanup_datasets_fix.py @@ -72,7 +72,7 @@ class Dataset( object ): # Create directory if it does not exist try: os.makedirs( dir ) - except OSError, e: + except OSError as e: # File Exists is okay, otherwise reraise if e.errno != errno.EEXIST: raise @@ -132,7 +132,7 @@ class Dataset( object ): """Remove the file that corresponds to this data""" try: os.remove(self.data.file_name) - except OSError, e: + except OSError as e: log.critical('%s delete error %s' % (self.__class__.__name__, e)) diff --git a/lib/galaxy/model/migrate/versions/0006_change_qual_datatype.py b/lib/galaxy/model/migrate/versions/0006_change_qual_datatype.py index 3a84009d96e..de3733670f7 100644 --- a/lib/galaxy/model/migrate/versions/0006_change_qual_datatype.py +++ b/lib/galaxy/model/migrate/versions/0006_change_qual_datatype.py @@ -37,24 +37,24 @@ def upgrade(migrate_engine): i = Index( 'ix_hda_extension', HistoryDatasetAssociation_table.c.extension ) try: i.create() - except Exception, e: + except Exception as e: log.debug( "Adding index 'ix_hda_extension' to history_dataset_association table failed: %s" % ( str( e ) ) ) # Set the default data in the galaxy_user table, but only for null values cmd = "UPDATE history_dataset_association SET extension = 'qual454' WHERE extension = 'qual' and peek like \'>%%\'" try: db_session.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "Resetting extension qual to qual454 in history_dataset_association failed: %s" % ( str( e ) ) ) cmd = "UPDATE history_dataset_association SET extension = 'qualsolexa' WHERE extension = 'qual' and peek not like \'>%%\'" try: db_session.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "Resetting extension qual to qualsolexa in history_dataset_association failed: %s" % ( str( e ) ) ) # Add 1 index to the history_dataset_association table try: i.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping index 'ix_hda_extension' to history_dataset_association table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0007_sharing_histories.py b/lib/galaxy/model/migrate/versions/0007_sharing_histories.py index c83bd51ad4d..3f959c7463c 100644 --- a/lib/galaxy/model/migrate/versions/0007_sharing_histories.py +++ b/lib/galaxy/model/migrate/versions/0007_sharing_histories.py @@ -41,7 +41,7 @@ def upgrade(migrate_engine): # Create the history_user_share_association table try: HistoryUserShareAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating history_user_share_association table failed: %s" % str( e ) ) # Add 1 column to the history table try: @@ -54,7 +54,7 @@ def upgrade(migrate_engine): col = Column( 'importable', Boolean, index=True, default=False ) col.create( History_table, index_name='ix_history_importable') assert col is History_table.c.importable - except Exception, e: + except Exception as e: log.debug( "Adding column 'importable' to history table failed: %s" % ( str( e ) ) ) @@ -72,10 +72,10 @@ def downgrade(migrate_engine): try: col = History_table.c.importable col.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping column 'importable' from history table failed: %s" % ( str( e ) ) ) # Drop the history_user_share_association table try: HistoryUserShareAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping history_user_share_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0008_galaxy_forms.py b/lib/galaxy/model/migrate/versions/0008_galaxy_forms.py index 4cc3e1cbbcf..b3adfd8370d 100644 --- a/lib/galaxy/model/migrate/versions/0008_galaxy_forms.py +++ b/lib/galaxy/model/migrate/versions/0008_galaxy_forms.py @@ -123,11 +123,11 @@ def upgrade(migrate_engine): # metadata.create_all() try: FormDefinitionCurrent_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating form_definition_current table failed: %s" % str( e ) ) try: FormDefinition_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating form_definition table failed: %s" % str( e ) ) # Add 1 foreign key constraint to the form_definition_current table if FormDefinitionCurrent_table is not None and FormDefinition_table is not None: @@ -137,31 +137,31 @@ def upgrade(migrate_engine): name='form_definition_current_latest_form_id_fk' ) # Create the constraint cons.create() - except Exception, e: + except Exception as e: log.debug( "Adding foreign key constraint 'form_definition_current_latest_form_id_fk' to table 'form_definition_current' failed: %s" % ( str( e ) ) ) try: FormValues_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating form_values table failed: %s" % str( e ) ) try: RequestType_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating request_type table failed: %s" % str( e ) ) try: Request_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating request table failed: %s" % str( e ) ) try: Sample_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating sample table failed: %s" % str( e ) ) try: SampleState_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating sample_state table failed: %s" % str( e ) ) try: SampleEvent_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating sample_event table failed: %s" % str( e ) ) @@ -171,33 +171,33 @@ def downgrade(migrate_engine): metadata.reflect() try: FormDefinition_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping form_definition table failed: %s" % str( e ) ) try: FormDefinitionCurrent_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping form_definition_current table failed: %s" % str( e ) ) try: FormValues_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping form_values table failed: %s" % str( e ) ) try: Request_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping request table failed: %s" % str( e ) ) try: RequestType_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping request_type table failed: %s" % str( e ) ) try: Sample_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping sample table failed: %s" % str( e ) ) try: SampleState_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping sample_state table failed: %s" % str( e ) ) try: SampleEvent_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping sample_event table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0009_request_table.py b/lib/galaxy/model/migrate/versions/0009_request_table.py index c51375f1c3c..72476ec5bf7 100644 --- a/lib/galaxy/model/migrate/versions/0009_request_table.py +++ b/lib/galaxy/model/migrate/versions/0009_request_table.py @@ -42,7 +42,7 @@ def upgrade(migrate_engine): col = Column( 'submitted', Boolean, default=False ) col.create( Request_table) assert col is Request_table.c.submitted - except Exception, e: + except Exception as e: log.debug( "Adding column 'submitted' to request table failed: %s" % ( str( e ) ) ) # Add 1 column to the sample table @@ -51,7 +51,7 @@ def upgrade(migrate_engine): col = Column( "bar_code", TrimmedString( 255 ), index=True ) col.create( Sample_table, index_name='ix_sample_bar_code') assert col is Sample_table.c.bar_code - except Exception, e: + except Exception as e: log.debug( "Adding column 'bar_code' to sample table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0010_hda_display_at_authz_table.py b/lib/galaxy/model/migrate/versions/0010_hda_display_at_authz_table.py index 453dbfd36e0..059013e550c 100644 --- a/lib/galaxy/model/migrate/versions/0010_hda_display_at_authz_table.py +++ b/lib/galaxy/model/migrate/versions/0010_hda_display_at_authz_table.py @@ -55,7 +55,7 @@ def upgrade(migrate_engine): metadata.reflect() try: HistoryDatasetAssociationDisplayAtAuthorization_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating history_dataset_association_display_at_authorization table failed: %s" % str( e ) ) @@ -65,5 +65,5 @@ def downgrade(migrate_engine): metadata.reflect() try: HistoryDatasetAssociationDisplayAtAuthorization_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping history_dataset_association_display_at_authorization table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0011_v0010_mysql_index_fix.py b/lib/galaxy/model/migrate/versions/0011_v0010_mysql_index_fix.py index 964c9685caa..8e69bd7d144 100644 --- a/lib/galaxy/model/migrate/versions/0011_v0010_mysql_index_fix.py +++ b/lib/galaxy/model/migrate/versions/0011_v0010_mysql_index_fix.py @@ -48,7 +48,7 @@ def upgrade(migrate_engine): i = Index( "ix_hdadaa_history_dataset_association_id", HistoryDatasetAssociationDisplayAtAuthorization_table.c.history_dataset_association_id ) try: i.create() - except Exception, e: + except Exception as e: log.debug( "Adding index 'ix_hdadaa_history_dataset_association_id' to table 'history_dataset_association_display_at_authorization' table failed: %s" % str( e ) ) @@ -60,5 +60,5 @@ def downgrade(migrate_engine): i = Index( "ix_hdadaa_history_dataset_association_id", HistoryDatasetAssociationDisplayAtAuthorization_table.c.history_dataset_association_id ) try: i.drop() - except Exception, e: + except Exception as e: log.debug( "Removing index 'ix_hdadaa_history_dataset_association_id' from table 'history_dataset_association_display_at_authorization' table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0012_user_address.py b/lib/galaxy/model/migrate/versions/0012_user_address.py index 31095ee6850..89beaf65e03 100644 --- a/lib/galaxy/model/migrate/versions/0012_user_address.py +++ b/lib/galaxy/model/migrate/versions/0012_user_address.py @@ -59,7 +59,7 @@ def upgrade(migrate_engine): # Add all of the new tables above try: UserAddress_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating user_address table failed: %s" % str( e ) ) # Add 1 column to the request_type table try: @@ -72,7 +72,7 @@ def upgrade(migrate_engine): col = Column( "deleted", Boolean, index=True, default=False ) col.create( RequestType_table, index_name='ix_request_type_deleted') assert col is RequestType_table.c.deleted - except Exception, e: + except Exception as e: log.debug( "Adding column 'deleted' to request_type table failed: %s" % ( str( e ) ) ) # Delete the submitted column diff --git a/lib/galaxy/model/migrate/versions/0013_change_lib_item_templates_to_forms.py b/lib/galaxy/model/migrate/versions/0013_change_lib_item_templates_to_forms.py index bfefeb07ba6..a7884890d24 100644 --- a/lib/galaxy/model/migrate/versions/0013_change_lib_item_templates_to_forms.py +++ b/lib/galaxy/model/migrate/versions/0013_change_lib_item_templates_to_forms.py @@ -82,7 +82,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table library_item_info_permissions" ) try: LibraryItemInfoPermissions_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_item_info_permissions table failed: %s" % str( e ) ) try: @@ -92,7 +92,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table library_item_info_template_permissions" ) try: LibraryItemInfoTemplatePermissions_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_item_info_template_permissions table failed: %s" % str( e ) ) try: @@ -102,7 +102,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table library_item_info_element" ) try: LibraryItemInfoElement_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_item_info_element table failed: %s" % str( e ) ) try: @@ -112,7 +112,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table library_item_info_template_element" ) try: LibraryItemInfoTemplateElement_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_item_info_template_element table failed: %s" % str( e ) ) try: @@ -122,7 +122,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table library_info_template_association" ) try: LibraryInfoTemplateAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_info_template_association table failed: %s" % str( e ) ) try: @@ -132,7 +132,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table library_folder_info_template_association" ) try: LibraryFolderInfoTemplateAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_folder_info_template_association table failed: %s" % str( e ) ) try: @@ -142,7 +142,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table library_dataset_info_template_association" ) try: LibraryDatasetInfoTemplateAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_dataset_info_template_association table failed: %s" % str( e ) ) try: @@ -152,7 +152,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table library_dataset_dataset_info_template_association" ) try: LibraryDatasetDatasetInfoTemplateAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_dataset_dataset_info_template_association table failed: %s" % str( e ) ) try: @@ -162,7 +162,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table library_info_association" ) try: LibraryInfoAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_info_association table failed: %s" % str( e ) ) try: @@ -172,7 +172,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table library_folder_info_association" ) try: LibraryFolderInfoAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_folder_info_association table failed: %s" % str( e ) ) try: @@ -182,7 +182,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table library_dataset_info_association" ) try: LibraryDatasetInfoAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_dataset_info_association table failed: %s" % str( e ) ) try: @@ -192,7 +192,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table library_dataset_dataset_info_association" ) try: LibraryDatasetDatasetInfoAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_dataset_dataset_info_association table failed: %s" % str( e ) ) try: @@ -202,7 +202,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table library_item_info" ) try: LibraryItemInfo_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_item_info table failed: %s" % str( e ) ) try: @@ -212,21 +212,21 @@ def upgrade(migrate_engine): log.debug( "Failed loading table library_item_info_template" ) try: LibraryItemInfoTemplate_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping library_item_info_template table failed: %s" % str( e ) ) # Create all new tables above try: LibraryInfoAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating library_info_association table failed: %s" % str( e ) ) try: LibraryFolderInfoAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating library_folder_info_association table failed: %s" % str( e ) ) try: LibraryDatasetDatasetInfoAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating library_dataset_dataset_info_association table failed: %s" % str( e ) ) # Fix index on LibraryDatasetDatasetInfoAssociation_table for mysql if migrate_engine.name == 'mysql': @@ -235,7 +235,7 @@ def upgrade(migrate_engine): i = Index( "ix_lddaia_ldda_id", LibraryDatasetDatasetInfoAssociation_table.c.library_dataset_dataset_association_id ) try: i.create() - except Exception, e: + except Exception as e: log.debug( "Adding index 'ix_lddaia_ldda_id' to table 'library_dataset_dataset_info_association' table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0014_pages.py b/lib/galaxy/model/migrate/versions/0014_pages.py index 42fa44f56af..97162751212 100644 --- a/lib/galaxy/model/migrate/versions/0014_pages.py +++ b/lib/galaxy/model/migrate/versions/0014_pages.py @@ -48,7 +48,7 @@ def upgrade(migrate_engine): # Create slug index manually afterward. i = Index( "ix_page_slug", Page_table.c.slug, mysql_length=200) i.create() - except Exception, ex: + except Exception as ex: log.debug(ex) log.debug( "Could not create page table" ) try: diff --git a/lib/galaxy/model/migrate/versions/0015_tagging.py b/lib/galaxy/model/migrate/versions/0015_tagging.py index 6eafbf9c57e..13f1ee4344a 100644 --- a/lib/galaxy/model/migrate/versions/0015_tagging.py +++ b/lib/galaxy/model/migrate/versions/0015_tagging.py @@ -72,22 +72,22 @@ def upgrade(migrate_engine): metadata.reflect() try: Tag_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating tag table failed: %s" % str( e ) ) try: HistoryTagAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating history_tag_association table failed: %s" % str( e ) ) try: DatasetTagAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating dataset_tag_association table failed: %s" % str( e ) ) try: HistoryDatasetAssociationTagAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating history_dataset_association_tag_association table failed: %s" % str( e ) ) @@ -97,21 +97,21 @@ def downgrade(migrate_engine): metadata.reflect() try: Tag_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping tag table failed: %s" % str( e ) ) try: HistoryTagAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping history_tag_association table failed: %s" % str( e ) ) try: DatasetTagAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping dataset_tag_association table failed: %s" % str( e ) ) try: HistoryDatasetAssociationTagAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping history_dataset_association_tag_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0016_v0015_mysql_index_fix.py b/lib/galaxy/model/migrate/versions/0016_v0015_mysql_index_fix.py index 742ce73571d..d8b415000e6 100644 --- a/lib/galaxy/model/migrate/versions/0016_v0015_mysql_index_fix.py +++ b/lib/galaxy/model/migrate/versions/0016_v0015_mysql_index_fix.py @@ -37,7 +37,7 @@ def upgrade(migrate_engine): i = Index( "ix_hda_ta_history_dataset_association_id", HistoryDatasetAssociationTagAssociation_table.c.history_dataset_association_id ) try: i.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Adding index 'ix_hdata_history_dataset_association_id' to table 'history_dataset_association_tag_association' table failed: %s" % str( e ) ) @@ -48,6 +48,6 @@ def downgrade(migrate_engine): i = Index( "ix_hda_ta_history_dataset_association_id", HistoryDatasetAssociationTagAssociation_table.c.history_dataset_association_id ) try: i.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Removing index 'ix_hdata_history_dataset_association_id' to table 'history_dataset_association_tag_association' table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0017_library_item_indexes.py b/lib/galaxy/model/migrate/versions/0017_library_item_indexes.py index 4e6174dcd43..e79c8897940 100644 --- a/lib/galaxy/model/migrate/versions/0017_library_item_indexes.py +++ b/lib/galaxy/model/migrate/versions/0017_library_item_indexes.py @@ -36,19 +36,19 @@ def upgrade(migrate_engine): i = Index( 'ix_library_folder_name', LibraryFolder_table.c.name, mysql_length=200 ) try: i.create() - except Exception, e: + except Exception as e: log.debug( "Adding index 'ix_library_folder_name' to library_folder table failed: %s" % ( str( e ) ) ) # Add 1 index to the library_dataset_dataset_association table i = Index( 'ix_library_dataset_dataset_association_name', LibraryDatasetDatasetAssociation_table.c.name ) try: i.create() - except Exception, e: + except Exception as e: log.debug( "Adding index 'ix_library_dataset_dataset_association_name' to library_dataset_dataset_association table failed: %s" % ( str( e ) ) ) # Add 1 index to the library_dataset table i = Index( 'ix_library_dataset_name', LibraryDataset_table.c.name ) try: i.create() - except Exception, e: + except Exception as e: log.debug( "Adding index 'ix_library_dataset_name' to library_dataset table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0018_ordered_tags_and_page_tags.py b/lib/galaxy/model/migrate/versions/0018_ordered_tags_and_page_tags.py index 062c77b8283..dc232ae37d5 100644 --- a/lib/galaxy/model/migrate/versions/0018_ordered_tags_and_page_tags.py +++ b/lib/galaxy/model/migrate/versions/0018_ordered_tags_and_page_tags.py @@ -65,14 +65,14 @@ def upgrade(migrate_engine): try: HistoryTagAssociation_table.drop() HistoryTagAssociation_table.create() - except Exception, e: + except Exception as e: print "Recreating history_tag_association table failed: %s" % str( e ) log.debug( "Recreating history_tag_association table failed: %s" % str( e ) ) try: DatasetTagAssociation_table.drop() DatasetTagAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Recreating dataset_tag_association table failed: %s" % str( e ) ) @@ -87,17 +87,17 @@ def upgrade(migrate_engine): i = Index( "ix_hda_ta_history_dataset_association_id", HistoryDatasetAssociationTagAssociation_table.c.history_dataset_association_id ) try: i.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Adding index 'ix_hda_ta_history_dataset_association_id' to table 'history_dataset_association_tag_association' table failed: %s" % str( e ) ) - except Exception, e: + except Exception as e: print str(e) log.debug( "Recreating history_dataset_association_tag_association table failed: %s" % str( e ) ) # Create page_tag_association table. try: PageTagAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating page_tag_association table failed: %s" % str( e ) ) @@ -111,6 +111,6 @@ def downgrade(migrate_engine): # Drop page_tag_association table. try: PageTagAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping page_tag_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0019_request_library_folder.py b/lib/galaxy/model/migrate/versions/0019_request_library_folder.py index b60b265ee13..3092cb12a60 100644 --- a/lib/galaxy/model/migrate/versions/0019_request_library_folder.py +++ b/lib/galaxy/model/migrate/versions/0019_request_library_folder.py @@ -44,7 +44,7 @@ def upgrade(migrate_engine): col = Column( "folder_id", Integer, index=True ) col.create( Request_table, index_name='ix_request_folder_id') assert col is Request_table.c.folder_id - except Exception, e: + except Exception as e: log.debug( "Adding column 'folder_id' to request table failed: %s" % ( str( e ) ) ) try: LibraryFolder_table = Table( "library_folder", metadata, autoload=True ) @@ -59,7 +59,7 @@ def upgrade(migrate_engine): name='request_folder_id_fk' ) # Create the constraint cons.create() - except Exception, e: + except Exception as e: log.debug( "Adding foreign key constraint 'request_folder_id_fk' to table 'library_folder' failed: %s" % ( str( e ) ) ) # Create the type column in form_definition try: @@ -72,13 +72,13 @@ def upgrade(migrate_engine): col = Column( "type", TrimmedString( 255 ), index=True ) col.create( FormDefinition_table, index_name='ix_form_definition_type') assert col is FormDefinition_table.c.type - except Exception, e: + except Exception as e: log.debug( "Adding column 'type' to form_definition table failed: %s" % ( str( e ) ) ) try: col = Column( "layout", JSONType()) col.create( FormDefinition_table ) assert col is FormDefinition_table.c.layout - except Exception, e: + except Exception as e: log.debug( "Adding column 'layout' to form_definition table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0020_library_upload_job.py b/lib/galaxy/model/migrate/versions/0020_library_upload_job.py index a68950b569a..fb3f6af0c36 100644 --- a/lib/galaxy/model/migrate/versions/0020_library_upload_job.py +++ b/lib/galaxy/model/migrate/versions/0020_library_upload_job.py @@ -43,7 +43,7 @@ def upgrade(migrate_engine): # Create the job_to_output_library_dataset table try: JobToOutputLibraryDatasetAssociation_table.create() - except Exception, e: + except Exception as e: print "Creating job_to_output_library_dataset table failed: %s" % str( e ) log.debug( "Creating job_to_output_library_dataset table failed: %s" % str( e ) ) # Create the library_folder_id column @@ -57,7 +57,7 @@ def upgrade(migrate_engine): col = Column( "library_folder_id", Integer, index=True ) col.create( Job_table, index_name='ix_job_library_folder_id') assert col is Job_table.c.library_folder_id - except Exception, e: + except Exception as e: log.debug( "Adding column 'library_folder_id' to job table failed: %s" % ( str( e ) ) ) try: LibraryFolder_table = Table( "library_folder", metadata, autoload=True ) @@ -74,7 +74,7 @@ def upgrade(migrate_engine): name='job_library_folder_id_fk' ) # Create the constraint cons.create() - except Exception, e: + except Exception as e: log.debug( "Adding foreign key constraint 'job_library_folder_id_fk' to table 'library_folder' failed: %s" % ( str( e ) ) ) # Create the ix_dataset_state index try: @@ -85,7 +85,7 @@ def upgrade(migrate_engine): i = Index( "ix_dataset_state", Dataset_table.c.state ) try: i.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Adding index 'ix_dataset_state' to dataset table failed: %s" % str( e ) ) @@ -103,12 +103,12 @@ def downgrade(migrate_engine): try: col = Job_table.c.library_folder_id col.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping column 'library_folder_id' from job table failed: %s" % ( str( e ) ) ) # Drop the job_to_output_library_dataset table try: JobToOutputLibraryDatasetAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping job_to_output_library_dataset table failed: %s" % str( e ) ) # Drop the ix_dataset_state index @@ -120,6 +120,6 @@ def downgrade(migrate_engine): i = Index( "ix_dataset_state", Dataset_table.c.state ) try: i.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping index 'ix_dataset_state' from dataset table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0021_user_prefs.py b/lib/galaxy/model/migrate/versions/0021_user_prefs.py index 8f4a34e2ae6..e7647e0d398 100644 --- a/lib/galaxy/model/migrate/versions/0021_user_prefs.py +++ b/lib/galaxy/model/migrate/versions/0021_user_prefs.py @@ -32,7 +32,7 @@ def upgrade(migrate_engine): metadata.reflect() try: UserPreference_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating user_preference table failed: %s" % str( e ) ) @@ -42,6 +42,6 @@ def downgrade(migrate_engine): metadata.reflect() try: UserPreference_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping user_preference table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0025_user_info.py b/lib/galaxy/model/migrate/versions/0025_user_info.py index c687e06ed67..c13a284e706 100644 --- a/lib/galaxy/model/migrate/versions/0025_user_info.py +++ b/lib/galaxy/model/migrate/versions/0025_user_info.py @@ -42,7 +42,7 @@ def upgrade(migrate_engine): col = Column( "form_values_id", Integer, index=True ) col.create( User_table, index_name='ix_user_form_values_id') assert col is User_table.c.form_values_id - except Exception, e: + except Exception as e: log.debug( "Adding column 'form_values_id' to galaxy_user table failed: %s" % ( str( e ) ) ) try: FormValues_table = Table( "form_values", metadata, autoload=True ) @@ -58,7 +58,7 @@ def upgrade(migrate_engine): name='user_form_values_id_fk' ) # Create the constraint cons.create() - except Exception, e: + except Exception as e: log.debug( "Adding foreign key constraint 'user_form_values_id_fk' to table 'galaxy_user' failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0027_request_events.py b/lib/galaxy/model/migrate/versions/0027_request_events.py index 5ab18f00b75..959fd58c704 100644 --- a/lib/galaxy/model/migrate/versions/0027_request_events.py +++ b/lib/galaxy/model/migrate/versions/0027_request_events.py @@ -63,7 +63,7 @@ def upgrade(migrate_engine): # Add new request_event table try: RequestEvent_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating request_event table failed: %s" % str( e ) ) # move the current state of all existing requests to the request_event table @@ -89,7 +89,7 @@ def upgrade(migrate_engine): if Request_table is not None: try: Request_table.c.state.drop() - except Exception, e: + except Exception as e: log.debug( "Deleting column 'state' to request table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0028_external_metadata_file_override.py b/lib/galaxy/model/migrate/versions/0028_external_metadata_file_override.py index 096a4a4c786..03e29102517 100644 --- a/lib/galaxy/model/migrate/versions/0028_external_metadata_file_override.py +++ b/lib/galaxy/model/migrate/versions/0028_external_metadata_file_override.py @@ -39,7 +39,7 @@ def upgrade(migrate_engine): col = Column( "filename_override_metadata", String( 255 ) ) col.create( job_external_output_metadata ) assert col is job_external_output_metadata.c.filename_override_metadata - except Exception, e: + except Exception as e: log.debug( "Adding column 'filename_override_metadata' to job_external_output_metadata table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0029_user_actions.py b/lib/galaxy/model/migrate/versions/0029_user_actions.py index 49d8a8143ab..787b133e769 100644 --- a/lib/galaxy/model/migrate/versions/0029_user_actions.py +++ b/lib/galaxy/model/migrate/versions/0029_user_actions.py @@ -34,7 +34,7 @@ def upgrade(migrate_engine): metadata.reflect() try: UserAction_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating user_action table failed: %s" % str( e ) ) @@ -44,6 +44,6 @@ def downgrade(migrate_engine): metadata.reflect() try: UserAction_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping user_action table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0031_community_and_workflow_tags.py b/lib/galaxy/model/migrate/versions/0031_community_and_workflow_tags.py index f483919bb02..0edeb977be7 100644 --- a/lib/galaxy/model/migrate/versions/0031_community_and_workflow_tags.py +++ b/lib/galaxy/model/migrate/versions/0031_community_and_workflow_tags.py @@ -43,7 +43,7 @@ def upgrade(migrate_engine): try: c.create( HistoryTagAssociation_table, index_name='ix_history_tag_association_user_id') assert c is HistoryTagAssociation_table.c.user_id - except Exception, e: + except Exception as e: # SQLite does not support 'ALTER TABLE ADD FOREIGN KEY', so catch exception if it arises. print str(e) log.debug( "Adding user_id column to history_tag_association table failed: %s" % str( e ) ) @@ -52,7 +52,7 @@ def upgrade(migrate_engine): try: c.create( HistoryTagAssociation_table) assert c is HistoryTagAssociation_table.c.user_id - except Exception, e: + except Exception as e: # SQLite does not support 'ALTER TABLE ADD FOREIGN KEY', so catch exception if it arises. print str(e) log.debug( "Adding user_id column to history_tag_association table failed: %s" % str( e ) ) @@ -69,7 +69,7 @@ def upgrade(migrate_engine): try: c.create( HistoryDatasetAssociationTagAssociation_table, index_name='ix_history_dataset_association_tag_association_user_id') assert c is HistoryDatasetAssociationTagAssociation_table.c.user_id - except Exception, e: + except Exception as e: # SQLite does not support 'ALTER TABLE ADD FOREIGN KEY', so catch exception if it arises. print str(e) log.debug( "Adding user_id column to history_dataset_association_tag_association table failed: %s" % str( e ) ) @@ -81,7 +81,7 @@ def upgrade(migrate_engine): try: c.create( HistoryDatasetAssociationTagAssociation_table) assert c is HistoryDatasetAssociationTagAssociation_table.c.user_id - except Exception, e: + except Exception as e: # SQLite does not support 'ALTER TABLE ADD FOREIGN KEY', so catch exception if it arises. print str(e) log.debug( "Adding user_id column to history_dataset_association_tag_association table failed: %s" % str( e ) ) @@ -97,7 +97,7 @@ def upgrade(migrate_engine): try: c.create( PageTagAssociation_table, index_name='ix_page_tag_association_user_id') assert c is PageTagAssociation_table.c.user_id - except Exception, e: + except Exception as e: # SQLite does not support 'ALTER TABLE ADD FOREIGN KEY', so catch exception if it arises. print str(e) log.debug( "Adding user_id column to page_tag_association table failed: %s" % str( e ) ) @@ -108,7 +108,7 @@ def upgrade(migrate_engine): try: c.create( PageTagAssociation_table ) assert c is PageTagAssociation_table.c.user_id - except Exception, e: + except Exception as e: # SQLite does not support 'ALTER TABLE ADD FOREIGN KEY', so catch exception if it arises. print str(e) log.debug( "Adding user_id column to page_tag_association table failed: %s" % str( e ) ) @@ -121,14 +121,14 @@ def upgrade(migrate_engine): # Create stored_workflow_tag_association table. try: StoredWorkflowTagAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating stored_workflow_tag_association table failed: %s" % str( e ) ) # Create workflow_tag_association table. try: WorkflowTagAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating workflow_tag_association table failed: %s" % str( e ) ) @@ -141,7 +141,7 @@ def downgrade(migrate_engine): HistoryTagAssociation_table = Table( "history_tag_association", metadata, autoload=True ) try: HistoryTagAssociation_table.c.user_id.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping column user_id from history_tag_association table failed: %s" % str( e ) ) @@ -149,7 +149,7 @@ def downgrade(migrate_engine): HistoryDatasetAssociationTagAssociation_table = Table( "history_dataset_association_tag_association", metadata, autoload=True ) try: HistoryDatasetAssociationTagAssociation_table.c.user_id.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping column user_id from history_dataset_association_tag_association table failed: %s" % str( e ) ) @@ -157,20 +157,20 @@ def downgrade(migrate_engine): PageTagAssociation_table = Table( "page_tag_association", metadata, autoload=True ) try: PageTagAssociation_table.c.user_id.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping column user_id from page_tag_association table failed: %s" % str( e ) ) # Drop stored_workflow_tag_association table. try: StoredWorkflowTagAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping stored_workflow_tag_association table failed: %s" % str( e ) ) # Drop workflow_tag_association table. try: WorkflowTagAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping workflow_tag_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0033_published_cols_for_histories_and_workflows.py b/lib/galaxy/model/migrate/versions/0033_published_cols_for_histories_and_workflows.py index 9ed0e866b69..a56e7b7b067 100644 --- a/lib/galaxy/model/migrate/versions/0033_published_cols_for_histories_and_workflows.py +++ b/lib/galaxy/model/migrate/versions/0033_published_cols_for_histories_and_workflows.py @@ -21,7 +21,7 @@ def upgrade(migrate_engine): try: c.create( History_table, index_name='ix_history_published') assert c is History_table.c.published - except Exception, e: + except Exception as e: print "Adding published column to history table failed: %s" % str( e ) log.debug( "Adding published column to history table failed: %s" % str( e ) ) @@ -40,7 +40,7 @@ def upgrade(migrate_engine): try: c.create( StoredWorkflow_table, index_name='ix_stored_workflow_published') assert c is StoredWorkflow_table.c.published - except Exception, e: + except Exception as e: print "Adding published column to stored_workflow table failed: %s" % str( e ) log.debug( "Adding published column to stored_workflow table failed: %s" % str( e ) ) @@ -59,7 +59,7 @@ def upgrade(migrate_engine): try: c.create( Page_table, index_name='ix_page_importable') assert c is Page_table.c.importable - except Exception, e: + except Exception as e: print "Adding importable column to page table failed: %s" % str( e ) log.debug( "Adding importable column to page table failed: %s" % str( e ) ) @@ -81,7 +81,7 @@ def downgrade(migrate_engine): History_table = Table( "history", metadata, autoload=True ) try: History_table.c.published.drop() - except Exception, e: + except Exception as e: print "Dropping column published from history table failed: %s" % str( e ) log.debug( "Dropping column published from history table failed: %s" % str( e ) ) @@ -89,7 +89,7 @@ def downgrade(migrate_engine): StoredWorkflow_table = Table( "stored_workflow", metadata, autoload=True ) try: StoredWorkflow_table.c.published.drop() - except Exception, e: + except Exception as e: print "Dropping column published from stored_workflow table failed: %s" % str( e ) log.debug( "Dropping column published from stored_workflow table failed: %s" % str( e ) ) @@ -97,6 +97,6 @@ def downgrade(migrate_engine): Page_table = Table( "page", metadata, autoload=True ) try: Page_table.c.importable.drop() - except Exception, e: + except Exception as e: print "Dropping column importable from page table failed: %s" % str( e ) log.debug( "Dropping column importable from page table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0034_page_user_share_association.py b/lib/galaxy/model/migrate/versions/0034_page_user_share_association.py index 8ef1b460345..33bfe87b4f7 100644 --- a/lib/galaxy/model/migrate/versions/0034_page_user_share_association.py +++ b/lib/galaxy/model/migrate/versions/0034_page_user_share_association.py @@ -22,7 +22,7 @@ def upgrade(migrate_engine): # Create stored_workflow_tag_association table. try: PageUserShareAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating page_user_share_association table failed: %s" % str( e ) ) @@ -34,6 +34,6 @@ def downgrade(migrate_engine): # Drop workflow_tag_association table. try: PageUserShareAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping page_user_share_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0035_item_annotations_and_workflow_step_tags.py b/lib/galaxy/model/migrate/versions/0035_item_annotations_and_workflow_step_tags.py index 7a5b84499f2..cf26eb1e435 100644 --- a/lib/galaxy/model/migrate/versions/0035_item_annotations_and_workflow_step_tags.py +++ b/lib/galaxy/model/migrate/versions/0035_item_annotations_and_workflow_step_tags.py @@ -54,35 +54,35 @@ def upgrade(migrate_engine): # Create history_annotation_association table. try: HistoryAnnotationAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating history_annotation_association table failed: %s" % str( e ) ) # Create history_dataset_association_annotation_association table. try: HistoryDatasetAssociationAnnotationAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating history_dataset_association_annotation_association table failed: %s" % str( e ) ) # Create stored_workflow_annotation_association table. try: StoredWorkflowAnnotationAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating stored_workflow_annotation_association table failed: %s" % str( e ) ) # Create workflow_step_annotation_association table. try: WorkflowStepAnnotationAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating workflow_step_annotation_association table failed: %s" % str( e ) ) # Create workflow_step_tag_association table. try: WorkflowStepTagAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating workflow_step_tag_association table failed: %s" % str( e ) ) @@ -96,7 +96,7 @@ def upgrade(migrate_engine): hdaaa.create() swaaa.create() wsaaa.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating annotation indices failed: %s" % str( e ) ) @@ -108,34 +108,34 @@ def downgrade(migrate_engine): # Drop history_annotation_association table. try: HistoryAnnotationAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping history_annotation_association table failed: %s" % str( e ) ) # Drop history_dataset_association_annotation_association table. try: HistoryDatasetAssociationAnnotationAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping history_dataset_association_annotation_association table failed: %s" % str( e ) ) # Drop stored_workflow_annotation_association table. try: StoredWorkflowAnnotationAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping stored_workflow_annotation_association table failed: %s" % str( e ) ) # Drop workflow_step_annotation_association table. try: WorkflowStepAnnotationAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping workflow_step_annotation_association table failed: %s" % str( e ) ) # Drop workflow_step_tag_association table. try: WorkflowStepTagAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping workflow_step_tag_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0036_add_deleted_column_to_library_template_assoc_tables.py b/lib/galaxy/model/migrate/versions/0036_add_deleted_column_to_library_template_assoc_tables.py index 2863b068695..b24984dd792 100644 --- a/lib/galaxy/model/migrate/versions/0036_add_deleted_column_to_library_template_assoc_tables.py +++ b/lib/galaxy/model/migrate/versions/0036_add_deleted_column_to_library_template_assoc_tables.py @@ -29,7 +29,7 @@ def upgrade(migrate_engine): cmd = "UPDATE library_info_association SET deleted = %s" % get_false_value(migrate_engine) try: migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "deleted to false in library_info_association failed: %s" % ( str( e ) ) ) LibraryFolderInfoAssociation_table = Table( "library_folder_info_association", metadata, autoload=True ) @@ -39,7 +39,7 @@ def upgrade(migrate_engine): cmd = "UPDATE library_folder_info_association SET deleted = %s" % get_false_value(migrate_engine) try: migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "deleted to false in library_folder_info_association failed: %s" % ( str( e ) ) ) LibraryDatasetDatasetInfoAssociation_table = Table( "library_dataset_dataset_info_association", metadata, autoload=True ) @@ -49,7 +49,7 @@ def upgrade(migrate_engine): cmd = "UPDATE library_dataset_dataset_info_association SET deleted = %s" % get_false_value(migrate_engine) try: migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "deleted to false in library_dataset_dataset_info_association failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0037_samples_library.py b/lib/galaxy/model/migrate/versions/0037_samples_library.py index c41c0f2eb86..cb77bfa949c 100644 --- a/lib/galaxy/model/migrate/versions/0037_samples_library.py +++ b/lib/galaxy/model/migrate/versions/0037_samples_library.py @@ -42,7 +42,7 @@ def upgrade(migrate_engine): col = Column( "datatx_info", JSONType() ) col.create( RequestType_table ) assert col is RequestType_table.c.datatx_info - except Exception, e: + except Exception as e: log.debug( "Adding column 'datatx_info' to request_type table failed: %s" % ( str( e ) ) ) # request table try: @@ -68,7 +68,7 @@ def upgrade(migrate_engine): Column( "deleted", Boolean, index=True, default=False ) ) try: RequestTemp_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating request_temp table failed: %s" % str( e ) ) # insert all the rows from the request table to the request_temp table cmd = "INSERT INTO request_temp SELECT id, create_time, " + \ @@ -78,7 +78,7 @@ def upgrade(migrate_engine): # delete the 'request' table try: Request_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping request table failed: %s" % str( e ) ) # rename table request_temp to request cmd = "ALTER TABLE request_temp RENAME TO request" @@ -87,12 +87,12 @@ def upgrade(migrate_engine): # Delete the library_id column in 'request' table try: Request_table.c.library_id.drop() - except Exception, e: + except Exception as e: log.debug( "Deleting column 'library_id' to request table failed: %s" % ( str( e ) ) ) # Delete the folder_id column in 'request' table try: Request_table.c.folder_id.drop() - except Exception, e: + except Exception as e: log.debug( "Deleting column 'folder_id' to request table failed: %s" % ( str( e ) ) ) # sample table try: @@ -106,7 +106,7 @@ def upgrade(migrate_engine): col = Column( "dataset_files", JSONType() ) col.create( Sample_table ) assert col is Sample_table.c.dataset_files - except Exception, e: + except Exception as e: log.debug( "Adding column 'dataset_files' to sample table failed: %s" % ( str( e ) ) ) # library table try: @@ -123,7 +123,7 @@ def upgrade(migrate_engine): col = Column( "library_id", Integer, index=True ) col.create( Sample_table, index_name='ix_sample_library_id') assert col is Sample_table.c.library_id - except Exception, e: + except Exception as e: log.debug( "Adding column 'library_id' to sample table failed: %s" % ( str( e ) ) ) # library_folder table try: @@ -140,7 +140,7 @@ def upgrade(migrate_engine): col = Column( "folder_id", Integer, index=True ) col.create( Sample_table, index_name='ix_sample_library_folder_id') assert col is Sample_table.c.folder_id - except Exception, e: + except Exception as e: log.debug( "Adding column 'folder_id' to sample table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0038_add_inheritable_column_to_library_template_assoc_tables.py b/lib/galaxy/model/migrate/versions/0038_add_inheritable_column_to_library_template_assoc_tables.py index 73caa15fd63..f319e3e9197 100644 --- a/lib/galaxy/model/migrate/versions/0038_add_inheritable_column_to_library_template_assoc_tables.py +++ b/lib/galaxy/model/migrate/versions/0038_add_inheritable_column_to_library_template_assoc_tables.py @@ -48,7 +48,7 @@ def upgrade(migrate_engine): Column( "deleted", Boolean, index=True, default=False ) ) try: Request_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating request table failed: %s" % str( e ) ) metadata.reflect() @@ -60,7 +60,7 @@ def upgrade(migrate_engine): cmd = "UPDATE library_info_association SET inheritable = %s" % get_false_value(migrate_engine) try: migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "Setting value of column inheritable to false in library_info_association failed: %s" % ( str( e ) ) ) LibraryFolderInfoAssociation_table = Table( "library_folder_info_association", metadata, autoload=True ) @@ -70,7 +70,7 @@ def upgrade(migrate_engine): cmd = "UPDATE library_folder_info_association SET inheritable = %s" % get_false_value(migrate_engine) try: migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "Setting value of column inheritable to false in library_folder_info_association failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0040_page_annotations.py b/lib/galaxy/model/migrate/versions/0040_page_annotations.py index d4ca1803617..eac206c6723 100644 --- a/lib/galaxy/model/migrate/versions/0040_page_annotations.py +++ b/lib/galaxy/model/migrate/versions/0040_page_annotations.py @@ -23,7 +23,7 @@ def upgrade(migrate_engine): # Create history_annotation_association table. try: PageAnnotationAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating page_annotation_association table failed: %s" % str( e ) ) @@ -35,6 +35,6 @@ def downgrade(migrate_engine): # Drop page_annotation_association table. try: PageAnnotationAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping page_annotation_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0043_visualization_sharing_tagging_annotating.py b/lib/galaxy/model/migrate/versions/0043_visualization_sharing_tagging_annotating.py index a8ebaa58b82..a1313a8cfc0 100644 --- a/lib/galaxy/model/migrate/versions/0043_visualization_sharing_tagging_annotating.py +++ b/lib/galaxy/model/migrate/versions/0043_visualization_sharing_tagging_annotating.py @@ -44,7 +44,7 @@ def upgrade(migrate_engine): # Create visualization_user_share_association table. try: VisualizationUserShareAssociation_table.create() - except Exception, e: + except Exception as e: print "Creating visualization_user_share_association table failed: %s" % str( e ) log.debug( "Creating visualization_user_share_association table failed: %s" % str( e ) ) @@ -68,7 +68,7 @@ def upgrade(migrate_engine): # Fill column with default value. cmd = "UPDATE visualization SET deleted = %s" % default_false migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: print "Adding deleted column to visualization table failed: %s" % str( e ) log.debug( "Adding deleted column to visualization table failed: %s" % str( e ) ) @@ -80,14 +80,14 @@ def upgrade(migrate_engine): # Fill column with default value. cmd = "UPDATE visualization SET importable = %s" % default_false migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: print "Adding importable column to visualization table failed: %s" % str( e ) log.debug( "Adding importable column to visualization table failed: %s" % str( e ) ) try: slug_column.create( Visualiation_table ) assert slug_column is Visualiation_table.c.slug - except Exception, e: + except Exception as e: print "Adding slug column to visualization table failed: %s" % str( e ) log.debug( "Adding slug column to visualization table failed: %s" % str( e ) ) @@ -99,7 +99,7 @@ def upgrade(migrate_engine): else: i = Index( "ix_visualization_slug", Visualiation_table.c.slug ) i.create() - except Exception, e: + except Exception as e: print "Adding index 'ix_visualization_slug' failed: %s" % str( e ) log.debug( "Adding index 'ix_visualization_slug' failed: %s" % str( e ) ) @@ -111,21 +111,21 @@ def upgrade(migrate_engine): # Fill column with default value. cmd = "UPDATE visualization SET published = %s" % default_false migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: print "Adding published column to visualization table failed: %s" % str( e ) log.debug( "Adding published column to visualization table failed: %s" % str( e ) ) # Create visualization_tag_association table. try: VisualizationTagAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating visualization_tag_association table failed: %s" % str( e ) ) # Create visualization_annotation_association table. try: VisualizationAnnotationAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating visualization_annotation_association table failed: %s" % str( e ) ) @@ -138,7 +138,7 @@ def upgrade(migrate_engine): else: i = Index( "ix_visualization_annotation_association_annotation", VisualizationAnnotationAssociation_table.c.annotation ) i.create() - except Exception, e: + except Exception as e: print "Adding index 'ix_visualization_annotation_association_annotation' failed: %s" % str( e ) log.debug( "Adding index 'ix_visualization_annotation_association_annotation' failed: %s" % str( e ) ) @@ -151,45 +151,45 @@ def downgrade(migrate_engine): # Drop visualization_user_share_association table. try: VisualizationUserShareAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping visualization_user_share_association table failed: %s" % str( e ) ) # Drop columns for supporting sharing from visualization table. try: Visualiation_table.c.deleted.drop() - except Exception, e: + except Exception as e: print "Dropping deleted column from visualization table failed: %s" % str( e ) log.debug( "Dropping deleted column from visualization table failed: %s" % str( e ) ) try: Visualiation_table.c.importable.drop() - except Exception, e: + except Exception as e: print "Dropping importable column from visualization table failed: %s" % str( e ) log.debug( "Dropping importable column from visualization table failed: %s" % str( e ) ) try: Visualiation_table.c.slug.drop() - except Exception, e: + except Exception as e: print "Dropping slug column from visualization table failed: %s" % str( e ) log.debug( "Dropping slug column from visualization table failed: %s" % str( e ) ) try: Visualiation_table.c.published.drop() - except Exception, e: + except Exception as e: print "Dropping published column from visualization table failed: %s" % str( e ) log.debug( "Dropping published column from visualization table failed: %s" % str( e ) ) # Drop visualization_tag_association table. try: VisualizationTagAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping visualization_tag_association table failed: %s" % str( e ) ) # Drop visualization_annotation_association table. try: VisualizationAnnotationAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping visualization_annotation_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0045_request_type_permissions_table.py b/lib/galaxy/model/migrate/versions/0045_request_type_permissions_table.py index 267f0efb85d..50701c25d6e 100644 --- a/lib/galaxy/model/migrate/versions/0045_request_type_permissions_table.py +++ b/lib/galaxy/model/migrate/versions/0045_request_type_permissions_table.py @@ -25,7 +25,7 @@ def upgrade(migrate_engine): metadata.reflect() try: RequestTypePermissions_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating request_type_permissions table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0047_job_table_user_id_column.py b/lib/galaxy/model/migrate/versions/0047_job_table_user_id_column.py index 9cf9cc7022b..5fcc597e7d2 100644 --- a/lib/galaxy/model/migrate/versions/0047_job_table_user_id_column.py +++ b/lib/galaxy/model/migrate/versions/0047_job_table_user_id_column.py @@ -36,14 +36,14 @@ def upgrade(migrate_engine): col = Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True, nullable=True ) col.create( Job_table, index_name='ix_job_user_id' ) assert col is Job_table.c.user_id - except Exception, e: + except Exception as e: log.debug( "Adding column 'user_id' to job table failed: %s" % ( str( e ) ) ) else: try: col = Column( "user_id", Integer, nullable=True) col.create( Job_table ) assert col is Job_table.c.user_id - except Exception, e: + except Exception as e: log.debug( "Adding column 'user_id' to job table failed: %s" % ( str( e ) ) ) try: cmd = "SELECT job.id AS galaxy_job_id, " \ @@ -62,7 +62,7 @@ def upgrade(migrate_engine): print "Updated the user_id column for ", update_count, " rows in the job table. " print len( job_users ) - update_count, " rows have no user_id since the value was NULL in the galaxy_session table." print "" - except Exception, e: + except Exception as e: log.debug( "Updating job.user_id column failed: %s" % str( e ) ) @@ -78,5 +78,5 @@ def downgrade(migrate_engine): try: col = Job_table.c.user_id col.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping column 'user_id' from job table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0048_dataset_instance_state_column.py b/lib/galaxy/model/migrate/versions/0048_dataset_instance_state_column.py index 8136a6c0065..77ea2dd7c30 100644 --- a/lib/galaxy/model/migrate/versions/0048_dataset_instance_state_column.py +++ b/lib/galaxy/model/migrate/versions/0048_dataset_instance_state_column.py @@ -41,7 +41,7 @@ def upgrade(migrate_engine): col = Column( "state", TrimmedString( 64 ), index=True, nullable=True ) col.create( dataset_instance_table, index_name=index_name) assert col is dataset_instance_table.c.state - except Exception, e: + except Exception as e: log.debug( "Adding column 'state' to %s table failed: %s" % ( table_name, str( e ) ) ) @@ -59,5 +59,5 @@ def downgrade(migrate_engine): try: col = dataset_instance_table.c.state col.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping column 'state' from %s table failed: %s" % ( table_name, str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0049_api_keys_table.py b/lib/galaxy/model/migrate/versions/0049_api_keys_table.py index 66c956a5a73..8f04cf7eca7 100644 --- a/lib/galaxy/model/migrate/versions/0049_api_keys_table.py +++ b/lib/galaxy/model/migrate/versions/0049_api_keys_table.py @@ -25,7 +25,7 @@ def upgrade(migrate_engine): metadata.reflect() try: APIKeys_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating api_keys table failed: %s" % str( e ) ) @@ -35,5 +35,5 @@ def downgrade(migrate_engine): metadata.reflect() try: APIKeys_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping api_keys table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0050_drop_cloud_tables.py b/lib/galaxy/model/migrate/versions/0050_drop_cloud_tables.py index a825555ca7d..ca252dde5bf 100644 --- a/lib/galaxy/model/migrate/versions/0050_drop_cloud_tables.py +++ b/lib/galaxy/model/migrate/versions/0050_drop_cloud_tables.py @@ -137,7 +137,7 @@ def upgrade(migrate_engine): UCI_table.drop() CloudUserCredentials_table.drop() CloudProvider_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping cloud tables failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0051_imported_col_for_jobs_table.py b/lib/galaxy/model/migrate/versions/0051_imported_col_for_jobs_table.py index fc40791b081..6a0bc3d4a17 100644 --- a/lib/galaxy/model/migrate/versions/0051_imported_col_for_jobs_table.py +++ b/lib/galaxy/model/migrate/versions/0051_imported_col_for_jobs_table.py @@ -29,7 +29,7 @@ def upgrade(migrate_engine): default_false = "false" migrate_engine.execute( "UPDATE job SET imported=%s" % default_false ) - except Exception, e: + except Exception as e: print "Adding imported column to job table failed: %s" % str( e ) log.debug( "Adding imported column to job table failed: %s" % str( e ) ) @@ -42,6 +42,6 @@ def downgrade(migrate_engine): Jobs_table = Table( "job", metadata, autoload=True ) try: Jobs_table.c.imported.drop() - except Exception, e: + except Exception as e: print "Dropping column imported from job table failed: %s" % str( e ) log.debug( "Dropping column imported from job table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0052_sample_dataset_table.py b/lib/galaxy/model/migrate/versions/0052_sample_dataset_table.py index 96eda329fd6..d3c8f9236f4 100644 --- a/lib/galaxy/model/migrate/versions/0052_sample_dataset_table.py +++ b/lib/galaxy/model/migrate/versions/0052_sample_dataset_table.py @@ -51,7 +51,7 @@ def upgrade(migrate_engine): metadata.reflect() try: SampleDataset_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating sample_dataset table failed: %s" % str( e ) ) cmd = "SELECT id, dataset_files FROM sample" @@ -83,7 +83,7 @@ def upgrade(migrate_engine): if Sample_table is not None: try: Sample_table.c.dataset_files.drop() - except Exception, e: + except Exception as e: log.debug( "Deleting column 'dataset_files' from the 'sample' table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0053_item_ratings.py b/lib/galaxy/model/migrate/versions/0053_item_ratings.py index 83b2df0d9b4..9d4ae1341c5 100644 --- a/lib/galaxy/model/migrate/versions/0053_item_ratings.py +++ b/lib/galaxy/model/migrate/versions/0053_item_ratings.py @@ -49,21 +49,21 @@ def upgrade(migrate_engine): # Create history_rating_association table. try: HistoryRatingAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating history_rating_association table failed: %s" % str( e ) ) # Create history_dataset_association_rating_association table. try: HistoryDatasetAssociationRatingAssociation_table.create() - except Exception, e: + except Exception as e: # MySQL cannot handle long index names; when we see this error, create the index name manually. if migrate_engine.name == 'mysql' and \ str(e).lower().find("identifier name 'ix_history_dataset_association_rating_association_history_dataset_association_id' is too long"): i = Index( "ix_hda_rating_association_hda_id", HistoryDatasetAssociationRatingAssociation_table.c.history_dataset_association_id ) try: i.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Adding index 'ix_hda_rating_association_hda_id' to table 'history_dataset_association_rating_association' table failed: %s" % str( e ) ) else: @@ -73,21 +73,21 @@ def upgrade(migrate_engine): # Create stored_workflow_rating_association table. try: StoredWorkflowRatingAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating stored_workflow_rating_association table failed: %s" % str( e ) ) # Create page_rating_association table. try: PageRatingAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating page_rating_association table failed: %s" % str( e ) ) # Create visualization_rating_association table. try: VisualizationRatingAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating visualization_rating_association table failed: %s" % str( e ) ) @@ -99,34 +99,34 @@ def downgrade(migrate_engine): # Drop history_rating_association table. try: HistoryRatingAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping history_rating_association table failed: %s" % str( e ) ) # Drop history_dataset_association_rating_association table. try: HistoryDatasetAssociationRatingAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping history_dataset_association_rating_association table failed: %s" % str( e ) ) # Drop stored_workflow_rating_association table. try: StoredWorkflowRatingAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping stored_workflow_rating_association table failed: %s" % str( e ) ) # Drop page_rating_association table. try: PageRatingAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping page_rating_association table failed: %s" % str( e ) ) # Drop visualization_rating_association table. try: VisualizationRatingAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping visualization_rating_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0055_add_pja_assoc_for_jobs.py b/lib/galaxy/model/migrate/versions/0055_add_pja_assoc_for_jobs.py index 777d913780a..6b19902f252 100644 --- a/lib/galaxy/model/migrate/versions/0055_add_pja_assoc_for_jobs.py +++ b/lib/galaxy/model/migrate/versions/0055_add_pja_assoc_for_jobs.py @@ -22,7 +22,7 @@ def upgrade(migrate_engine): metadata.reflect() try: PostJobActionAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating PostJobActionAssociation table failed: %s" % str( e ) ) @@ -32,5 +32,5 @@ def downgrade(migrate_engine): metadata.reflect() try: PostJobActionAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping PostJobActionAssociation table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0057_request_notify.py b/lib/galaxy/model/migrate/versions/0057_request_notify.py index 2ee057e3e86..827d176eb3c 100644 --- a/lib/galaxy/model/migrate/versions/0057_request_notify.py +++ b/lib/galaxy/model/migrate/versions/0057_request_notify.py @@ -32,7 +32,7 @@ def upgrade(migrate_engine): col = Column( "notification", JSONType() ) col.create( Request_table ) assert col is Request_table.c.notification - except Exception, e: + except Exception as e: log.debug( "Creating column 'notification' in the 'request' table failed: %s" % ( str( e ) ) ) cmd = "SELECT id, user_id, notify FROM request" @@ -47,7 +47,7 @@ def upgrade(migrate_engine): if migrate_engine.name != 'sqlite': try: Request_table.c.notify.drop() - except Exception, e: + except Exception as e: log.debug( "Deleting column 'notify' from the 'request' table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0058_history_import_export.py b/lib/galaxy/model/migrate/versions/0058_history_import_export.py index 070bfc7474a..ddce22ce81a 100644 --- a/lib/galaxy/model/migrate/versions/0058_history_import_export.py +++ b/lib/galaxy/model/migrate/versions/0058_history_import_export.py @@ -29,7 +29,7 @@ def upgrade(migrate_engine): # Create job_export_history_archive table. try: JobExportHistoryArchive_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating job_export_history_archive table failed: %s" % str( e ) ) @@ -41,6 +41,6 @@ def downgrade(migrate_engine): # Drop job_export_history_archive table. try: JobExportHistoryArchive_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping job_export_history_archive table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0059_sample_dataset_file_path.py b/lib/galaxy/model/migrate/versions/0059_sample_dataset_file_path.py index aa78fa5c71f..16df1aa883b 100644 --- a/lib/galaxy/model/migrate/versions/0059_sample_dataset_file_path.py +++ b/lib/galaxy/model/migrate/versions/0059_sample_dataset_file_path.py @@ -33,14 +33,14 @@ def upgrade(migrate_engine): # remove the 'file_path' column try: SampleDataset_table.c.file_path.drop() - except Exception, e: + except Exception as e: log.debug( "Deleting column 'file_path' from the 'sample_dataset' table failed: %s" % ( str( e ) ) ) # create the column again try: col = Column( "file_path", TEXT ) col.create( SampleDataset_table ) assert col is SampleDataset_table.c.file_path - except Exception, e: + except Exception as e: log.debug( "Creating column 'file_path' in the 'sample_dataset' table failed: %s" % ( str( e ) ) ) for id, file_path in filepath_dict.items(): diff --git a/lib/galaxy/model/migrate/versions/0060_history_archive_import.py b/lib/galaxy/model/migrate/versions/0060_history_archive_import.py index 6d6c17190af..d6f7a815fa9 100644 --- a/lib/galaxy/model/migrate/versions/0060_history_archive_import.py +++ b/lib/galaxy/model/migrate/versions/0060_history_archive_import.py @@ -40,14 +40,14 @@ def upgrade(migrate_engine): elif migrate_engine.name in ['postgres', 'postgresql']: default_false = "false" migrate_engine.execute( "UPDATE history SET importing=%s" % default_false ) - except Exception, e: + except Exception as e: print str(e) log.debug( "Adding column 'importing' to history table failed: %s" % str( e ) ) # Create job_import_history_archive table. try: JobImportHistoryArchive_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating job_import_history_archive table failed: %s" % str( e ) ) @@ -60,11 +60,11 @@ def downgrade(migrate_engine): History_table = Table( "history", metadata, autoload=True ) importing_col = History_table.c.importing importing_col.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping column 'importing' from history table failed: %s" % ( str( e ) ) ) # Drop job_import_history_archive table. try: JobImportHistoryArchive_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping job_import_history_archive table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0062_user_openid_table.py b/lib/galaxy/model/migrate/versions/0062_user_openid_table.py index 1430645880c..db8e25fefd2 100644 --- a/lib/galaxy/model/migrate/versions/0062_user_openid_table.py +++ b/lib/galaxy/model/migrate/versions/0062_user_openid_table.py @@ -30,7 +30,7 @@ def upgrade(migrate_engine): # Create galaxy_user_openid table try: UserOpenID_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating galaxy_user_openid table failed: %s" % str( e ) ) ix_name = 'ix_galaxy_user_openid_openid' @@ -41,7 +41,7 @@ def upgrade(migrate_engine): i = Index( ix_name, UserOpenID_table.c.openid, unique=True ) try: i.create() - except Exception, e: + except Exception as e: log.debug( "Adding index '%s' failed: %s" % ( ix_name, str( e ) ) ) @@ -52,5 +52,5 @@ def downgrade(migrate_engine): # Drop galaxy_user_openid table try: UserOpenID_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping galaxy_user_openid table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0063_sequencer_table.py b/lib/galaxy/model/migrate/versions/0063_sequencer_table.py index 85ea0acebb5..f1d2b39ddc7 100644 --- a/lib/galaxy/model/migrate/versions/0063_sequencer_table.py +++ b/lib/galaxy/model/migrate/versions/0063_sequencer_table.py @@ -34,7 +34,7 @@ def upgrade(migrate_engine): # create the sequencer table try: Sequencer_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating 'sequencer' table failed: %s" % str( e ) ) @@ -50,5 +50,5 @@ def downgrade(migrate_engine): if Sequencer_table: try: Sequencer_table.drop() - except Exception, e: + except Exception as e: log.debug( "Deleting 'sequencer' table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0064_add_run_and_sample_run_association_tables.py b/lib/galaxy/model/migrate/versions/0064_add_run_and_sample_run_association_tables.py index efdbe4306c9..9233e7a7cb8 100644 --- a/lib/galaxy/model/migrate/versions/0064_add_run_and_sample_run_association_tables.py +++ b/lib/galaxy/model/migrate/versions/0064_add_run_and_sample_run_association_tables.py @@ -35,15 +35,15 @@ def upgrade(migrate_engine): metadata.reflect() try: Run_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating Run_table table failed: %s" % str( e ) ) try: RequestTypeRunAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating RequestTypeRunAssociation table failed: %s" % str( e ) ) try: SampleRunAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating SampleRunAssociation table failed: %s" % str( e ) ) @@ -53,13 +53,13 @@ def downgrade(migrate_engine): metadata.reflect() try: SampleRunAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping SampleRunAssociation table failed: %s" % str( e ) ) try: RequestTypeRunAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping RequestTypeRunAssociation table failed: %s" % str( e ) ) try: Run_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping Run_table table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0065_add_name_to_form_fields_and_values.py b/lib/galaxy/model/migrate/versions/0065_add_name_to_form_fields_and_values.py index ca1dbdd24cf..792cc579f9e 100644 --- a/lib/galaxy/model/migrate/versions/0065_add_name_to_form_fields_and_values.py +++ b/lib/galaxy/model/migrate/versions/0065_add_name_to_form_fields_and_values.py @@ -29,11 +29,11 @@ def upgrade(migrate_engine): metadata.reflect() try: Table( "form_definition", metadata, autoload=True ) - except Exception, e: + except Exception as e: log.debug( "Loading 'form_definition' table failed: %s" % str( e ) ) try: Table( "form_values", metadata, autoload=True ) - except Exception, e: + except Exception as e: log.debug( "Loading 'form_values' table failed: %s" % str( e ) ) def get_value(lst, index): @@ -91,11 +91,11 @@ def downgrade(migrate_engine): metadata.reflect() try: Table( "form_definition", metadata, autoload=True ) - except Exception, e: + except Exception as e: log.debug( "Loading 'form_definition' table failed: %s" % str( e ) ) try: Table( "form_values", metadata, autoload=True ) - except Exception, e: + except Exception as e: log.debug( "Loading 'form_values' table failed: %s" % str( e ) ) # remove the name attribute in the content column JSON dict in the form_values table # and restore it to a list of values diff --git a/lib/galaxy/model/migrate/versions/0066_deferred_job_and_transfer_job_tables.py b/lib/galaxy/model/migrate/versions/0066_deferred_job_and_transfer_job_tables.py index d731aec8ecc..60855fc56a2 100644 --- a/lib/galaxy/model/migrate/versions/0066_deferred_job_and_transfer_job_tables.py +++ b/lib/galaxy/model/migrate/versions/0066_deferred_job_and_transfer_job_tables.py @@ -40,13 +40,13 @@ def upgrade(migrate_engine): # Create deferred_job table try: DeferredJob_table.create() - except Exception, e: + except Exception as e: log.error( "Creating deferred_job table failed: %s" % str( e ) ) # Create transfer_job table try: TransferJob_table.create() - except Exception, e: + except Exception as e: log.error( "Creating transfer_job table failed: %s" % str( e ) ) @@ -57,11 +57,11 @@ def downgrade(migrate_engine): # Drop deferred_job table try: DeferredJob_table.drop() - except Exception, e: + except Exception as e: log.error( "Dropping deferred_job table failed: %s" % str( e ) ) # Drop transfer_job table try: TransferJob_table.drop() - except Exception, e: + except Exception as e: log.error( "Dropping transfer_job table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0067_populate_sequencer_table.py b/lib/galaxy/model/migrate/versions/0067_populate_sequencer_table.py index a34759267e9..71dc1884207 100644 --- a/lib/galaxy/model/migrate/versions/0067_populate_sequencer_table.py +++ b/lib/galaxy/model/migrate/versions/0067_populate_sequencer_table.py @@ -211,7 +211,7 @@ def upgrade(migrate_engine): col = Column( "sequencer_id", Integer, ForeignKey( "sequencer.id" ), nullable=True ) col.create( RequestType_table ) assert col is RequestType_table.c.sequencer_id - except Exception, e: + except Exception as e: log.debug( "Creating column 'sequencer_id' in the 'request_type' table failed: %s" % ( str( e ) ) ) # copy the sequencer information contained in the 'datatx_info' column # of the request_type table to the form values referenced in the sequencer table @@ -249,7 +249,7 @@ def upgrade(migrate_engine): # Finally delete the 'datatx_info' column from the request_type table try: RequestType_table.c.datatx_info.drop() - except Exception, e: + except Exception as e: log.debug( "Deleting column 'datatx_info' in the 'request_type' table failed: %s" % ( str( e ) ) ) @@ -267,7 +267,7 @@ def downgrade(migrate_engine): col = Column( "datatx_info", JSONType() ) col.create( RequestType_table ) assert col is RequestType_table.c.datatx_info - except Exception, e: + except Exception as e: log.debug( "Creating column 'datatx_info' in the 'request_type' table failed: %s" % ( str( e ) ) ) # restore the datatx_info column data in the request_type table with data from # the sequencer and the form_values table @@ -291,5 +291,5 @@ def downgrade(migrate_engine): # delete foreign key field to the sequencer table in the request_type table try: RequestType_table.c.sequencer_id.drop() - except Exception, e: + except Exception as e: log.debug( "Deleting column 'sequencer_id' in the 'request_type' table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0068_rename_sequencer_to_external_services.py b/lib/galaxy/model/migrate/versions/0068_rename_sequencer_to_external_services.py index f9ea4312457..7199dceb803 100644 --- a/lib/galaxy/model/migrate/versions/0068_rename_sequencer_to_external_services.py +++ b/lib/galaxy/model/migrate/versions/0068_rename_sequencer_to_external_services.py @@ -56,7 +56,7 @@ def upgrade(migrate_engine): col = Column( "external_service_id", Integer, index=True ) col.create( SampleDataset_table, index_name="ix_sample_dataset_external_service_id" ) assert col is SampleDataset_table.c.external_service_id - except Exception, e: + except Exception as e: log.debug( "Creating column 'external_service_id' in the 'sample_dataset' table failed: %s" % ( str( e ) ) ) if migrate_engine.name != 'sqlite': # Add the foreign key constraint @@ -66,7 +66,7 @@ def upgrade(migrate_engine): name='sample_dataset_external_services_id_fk' ) # Create the constraint cons.create() - except Exception, e: + except Exception as e: log.debug( "Adding foreign key constraint 'sample_dataset_external_services_id_fk' to table 'sample_dataset' failed: %s" % ( str( e ) ) ) # populate the column cmd = "SELECT sample_dataset.id, request_type.sequencer_id " \ @@ -107,7 +107,7 @@ def upgrade(migrate_engine): col = Column( "external_service_type_id", TrimmedString( 255 ) ) col.create( ExternalServices_table ) assert col is ExternalServices_table.c.external_service_type_id - except Exception, e: + except Exception as e: log.debug( "Creating column 'external_service_type_id' in the 'external_service' table failed: %s" % ( str( e ) ) ) # populate this new column cmd = "UPDATE external_service SET external_service_type_id=sequencer_type_id" @@ -115,7 +115,7 @@ def upgrade(migrate_engine): # remove the 'sequencer_type_id' column try: ExternalServices_table.c.sequencer_type_id.drop() - except Exception, e: + except Exception as e: log.debug( "Deleting column 'sequencer_type_id' from the 'external_service' table failed: %s" % ( str( e ) ) ) # create 'request_type_external_service_association' table RequestTypeExternalServiceAssociation_table = Table( "request_type_external_service_association", metadata, @@ -124,7 +124,7 @@ def upgrade(migrate_engine): Column( "external_service_id", Integer, ForeignKey( "external_service.id" ), index=True ) ) try: RequestTypeExternalServiceAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating request_type_external_service_association table failed: %s" % str( e ) ) try: RequestTypeExternalServiceAssociation_table = Table( "request_type_external_service_association", metadata, autoload=True ) @@ -165,7 +165,7 @@ def upgrade(migrate_engine): Column( "deleted", Boolean, index=True, default=False ) ) try: RequestTypeTemp_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating request_type_temp table failed: %s" % str( e ) ) # insert all the rows from the request table to the request_temp table cmd = "INSERT INTO request_type_temp SELECT id, create_time," + \ @@ -175,7 +175,7 @@ def upgrade(migrate_engine): # delete the 'request_type' table try: RequestType_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping request_type table failed: %s" % str( e ) ) # rename table request_temp to request cmd = "ALTER TABLE request_type_temp RENAME TO request_type" @@ -183,7 +183,7 @@ def upgrade(migrate_engine): else: try: RequestType_table.c.sequencer_id.drop() - except Exception, e: + except Exception as e: log.debug( "Deleting column 'sequencer_id' from the 'request_type' table failed: %s" % ( str( e ) ) ) @@ -216,7 +216,7 @@ def downgrade(migrate_engine): col = Column( "sequencer_id", Integer, ForeignKey( "external_service.id" ), nullable=True, index=True ) col.create( RequestType_table ) assert col is RequestType_table.c.sequencer_id - except Exception, e: + except Exception as e: log.debug( "Creating column 'sequencer_id' in the 'request_type' table failed: %s" % ( str( e ) ) ) # populate 'sequencer_id' column in the 'request_type' table from the # 'request_type_external_service_association' table @@ -234,7 +234,7 @@ def downgrade(migrate_engine): if RequestTypeExternalServiceAssociation_table is not None: try: RequestTypeExternalServiceAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Deleting 'request_type_external_service_association' table failed: %s" % str( e ) ) # rename 'external_service_type_id' column to 'sequencer_type_id' in the table 'external_service' # create the column 'sequencer_type_id' @@ -242,7 +242,7 @@ def downgrade(migrate_engine): col = Column( "sequencer_type_id", TrimmedString( 255 ) ) col.create( ExternalServices_table ) assert col is ExternalServices_table.c.sequencer_type_id - except Exception, e: + except Exception as e: log.debug( "Creating column 'sequencer_type_id' in the 'external_service' table failed: %s" % ( str( e ) ) ) # populate this new column cmd = "UPDATE external_service SET sequencer_type_id=external_service_type_id" @@ -250,7 +250,7 @@ def downgrade(migrate_engine): # remove the 'external_service_type_id' column try: ExternalServices_table.c.external_service_type_id.drop() - except Exception, e: + except Exception as e: log.debug( "Deleting column 'external_service_type_id' from the 'external_service' table failed: %s" % ( str( e ) ) ) # rename the 'external_service' table to 'sequencer' cmd = "ALTER TABLE external_service RENAME TO sequencer" @@ -269,5 +269,5 @@ def downgrade(migrate_engine): return try: SampleDataset_table.c.external_service_id.drop() - except Exception, e: + except Exception as e: log.debug( "Deleting column 'external_service_id' from the 'sample_dataset' table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0070_add_info_column_to_deferred_job_table.py b/lib/galaxy/model/migrate/versions/0070_add_info_column_to_deferred_job_table.py index edaa0c7f554..5b37a99777a 100644 --- a/lib/galaxy/model/migrate/versions/0070_add_info_column_to_deferred_job_table.py +++ b/lib/galaxy/model/migrate/versions/0070_add_info_column_to_deferred_job_table.py @@ -18,7 +18,7 @@ def upgrade(migrate_engine): c = Column( "info", TEXT ) c.create( TransferJob_table ) assert c is TransferJob_table.c.info - except Exception, e: + except Exception as e: print "Adding info column to transfer_job table failed: %s" % str( e ) log.debug( "Adding info column to transfer_job table failed: %s" % str( e ) ) @@ -29,6 +29,6 @@ def downgrade(migrate_engine): try: TransferJob_table = Table( "transfer_job", metadata, autoload=True ) TransferJob_table.c.info.drop() - except Exception, e: + except Exception as e: print "Dropping info column from transfer_job table failed: %s" % str( e ) log.debug( "Dropping info column from transfer_job table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0071_add_history_and_workflow_to_sample.py b/lib/galaxy/model/migrate/versions/0071_add_history_and_workflow_to_sample.py index a8f2db7b0e2..15f60026a78 100644 --- a/lib/galaxy/model/migrate/versions/0071_add_history_and_workflow_to_sample.py +++ b/lib/galaxy/model/migrate/versions/0071_add_history_and_workflow_to_sample.py @@ -23,7 +23,7 @@ def upgrade(migrate_engine): c2.create( Sample_table ) assert c1 is Sample_table.c.workflow assert c2 is Sample_table.c.history_id - except Exception, e: + except Exception as e: print "Adding history and workflow columns to sample table failed: %s" % str( e ) log.debug( "Adding history and workflow columns to sample table failed: %s" % str( e ) ) @@ -34,12 +34,12 @@ def downgrade(migrate_engine): try: Sample_table = Table( "sample", metadata, autoload=True ) Sample_table.c.workflow.drop() - except Exception, e: + except Exception as e: print "Dropping workflow column from sample table failed: %s" % str( e ) log.debug( "Dropping workflow column from sample table failed: %s" % str( e ) ) try: Sample_table = Table( "sample", metadata, autoload=True ) Sample_table.c.history_id.drop() - except Exception, e: + except Exception as e: print "Dropping history column from sample table failed: %s" % str( e ) log.debug( "Dropping history column from sample table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0072_add_pid_and_socket_columns_to_transfer_job_table.py b/lib/galaxy/model/migrate/versions/0072_add_pid_and_socket_columns_to_transfer_job_table.py index ef05650c0ba..19c9531f62e 100644 --- a/lib/galaxy/model/migrate/versions/0072_add_pid_and_socket_columns_to_transfer_job_table.py +++ b/lib/galaxy/model/migrate/versions/0072_add_pid_and_socket_columns_to_transfer_job_table.py @@ -21,7 +21,7 @@ def upgrade(migrate_engine): c = Column( "socket", Integer ) c.create( TransferJob_table ) assert c is TransferJob_table.c.socket - except Exception, e: + except Exception as e: print "Adding columns to transfer_job table failed: %s" % str( e ) log.debug( "Adding columns to transfer_job table failed: %s" % str( e ) ) @@ -33,6 +33,6 @@ def downgrade(migrate_engine): TransferJob_table = Table( "transfer_job", metadata, autoload=True ) TransferJob_table.c.pid.drop() TransferJob_table.c.socket.drop() - except Exception, e: + except Exception as e: print "Dropping columns from transfer_job table failed: %s" % str( e ) log.debug( "Dropping columns from transfer_job table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0073_add_ldda_to_implicit_conversion_table.py b/lib/galaxy/model/migrate/versions/0073_add_ldda_to_implicit_conversion_table.py index 4d599172ad1..c250ed898b1 100644 --- a/lib/galaxy/model/migrate/versions/0073_add_ldda_to_implicit_conversion_table.py +++ b/lib/galaxy/model/migrate/versions/0073_add_ldda_to_implicit_conversion_table.py @@ -22,7 +22,7 @@ def upgrade(migrate_engine): c = Column( "ldda_parent_id", Integer, index=True, nullable=True ) c.create( Implicitly_converted_table, index_name="ix_implicitly_converted_dataset_assoc_ldda_parent_id") assert c is Implicitly_converted_table.c.ldda_parent_id - except Exception, e: + except Exception as e: print "Adding ldda_parent_id column to implicitly_converted_dataset_association table failed: %s" % str( e ) log.debug( "Adding ldda_parent_id column to implicitly_converted_dataset_association table failed: %s" % str( e ) ) @@ -33,6 +33,6 @@ def downgrade(migrate_engine): try: Implicitly_converted_table = Table( "implicitly_converted_dataset_association", metadata, autoload=True ) Implicitly_converted_table.c.ldda_parent_id.drop() - except Exception, e: + except Exception as e: print "Dropping ldda_parent_id column from implicitly_converted_dataset_association table failed: %s" % str( e ) log.debug( "Dropping ldda_parent_id column from implicitly_converted_dataset_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0074_add_purged_column_to_library_dataset_table.py b/lib/galaxy/model/migrate/versions/0074_add_purged_column_to_library_dataset_table.py index f2168d3cb0f..6ca67a53b04 100644 --- a/lib/galaxy/model/migrate/versions/0074_add_purged_column_to_library_dataset_table.py +++ b/lib/galaxy/model/migrate/versions/0074_add_purged_column_to_library_dataset_table.py @@ -36,13 +36,13 @@ def upgrade(migrate_engine): c = Column( "purged", Boolean, index=True, default=False ) c.create( LibraryDataset_table, index_name='ix_library_dataset_purged') assert c is LibraryDataset_table.c.purged - except Exception, e: + except Exception as e: print "Adding purged column to library_dataset table failed: ", str( e ) # Update the purged flag to the default False cmd = "UPDATE library_dataset SET purged = %s;" % boolean_false(migrate_engine) try: migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "Setting default data for library_dataset.purged column failed: %s" % ( str( e ) ) ) # Update the purged flag for those LibaryDatasets whose purged flag should be True. This happens @@ -64,5 +64,5 @@ def downgrade(migrate_engine): try: LibraryDataset_table = Table( "library_dataset", metadata, autoload=True ) LibraryDataset_table.c.purged.drop() - except Exception, e: + except Exception as e: print "Dropping purged column from library_dataset table failed: ", str( e ) diff --git a/lib/galaxy/model/migrate/versions/0075_add_subindex_column_to_run_table.py b/lib/galaxy/model/migrate/versions/0075_add_subindex_column_to_run_table.py index 651246407ea..6a619c496bf 100644 --- a/lib/galaxy/model/migrate/versions/0075_add_subindex_column_to_run_table.py +++ b/lib/galaxy/model/migrate/versions/0075_add_subindex_column_to_run_table.py @@ -17,7 +17,7 @@ def upgrade(migrate_engine): c = Column( "subindex", TrimmedString( 255 ), index=True ) c.create( Run_table, index_name="ix_run_subindex") assert c is Run_table.c.subindex - except Exception, e: + except Exception as e: print "Adding the subindex column to the run table failed: ", str( e ) @@ -27,5 +27,5 @@ def downgrade(migrate_engine): try: Run_table = Table( "run", metadata, autoload=True ) Run_table.c.subindex.drop() - except Exception, e: + except Exception as e: print "Dropping the subindex column from run table failed: ", str( e ) diff --git a/lib/galaxy/model/migrate/versions/0077_create_tool_tag_association_table.py b/lib/galaxy/model/migrate/versions/0077_create_tool_tag_association_table.py index c85a080d362..c44b11d5784 100644 --- a/lib/galaxy/model/migrate/versions/0077_create_tool_tag_association_table.py +++ b/lib/galaxy/model/migrate/versions/0077_create_tool_tag_association_table.py @@ -32,7 +32,7 @@ def upgrade(migrate_engine): # Create tool_tag_association table try: ToolTagAssociation_table.create() - except Exception, e: + except Exception as e: log.error( "Creating tool_tag_association table failed: %s" % str( e ) ) @@ -43,5 +43,5 @@ def downgrade(migrate_engine): # Drop tool_tag_association table try: ToolTagAssociation_table.drop() - except Exception, e: + except Exception as e: log.error( "Dropping tool_tag_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0078_add_columns_for_disk_usage_accounting.py b/lib/galaxy/model/migrate/versions/0078_add_columns_for_disk_usage_accounting.py index cd780cc984d..98cc3b1001a 100644 --- a/lib/galaxy/model/migrate/versions/0078_add_columns_for_disk_usage_accounting.py +++ b/lib/galaxy/model/migrate/versions/0078_add_columns_for_disk_usage_accounting.py @@ -21,7 +21,7 @@ def upgrade(migrate_engine): c = Column( 'total_size', Numeric( 15, 0 ) ) c.create( Dataset_table ) assert c is Dataset_table.c.total_size - except Exception, e: + except Exception as e: print "Adding total_size column to dataset table failed: %s" % str( e ) log.debug( "Adding total_size column to dataset table failed: %s" % str( e ) ) @@ -31,7 +31,7 @@ def upgrade(migrate_engine): c.create( HistoryDatasetAssociation_table, index_name="ix_history_dataset_association_purged") assert c is HistoryDatasetAssociation_table.c.purged migrate_engine.execute(HistoryDatasetAssociation_table.update().values(purged=False)) - except Exception, e: + except Exception as e: print "Adding purged column to history_dataset_association table failed: %s" % str( e ) log.debug( "Adding purged column to history_dataset_association table failed: %s" % str( e ) ) @@ -40,7 +40,7 @@ def upgrade(migrate_engine): c = Column( 'disk_usage', Numeric( 15, 0 ), index=True ) c.create( User_table, index_name="ix_galaxy_user_disk_usage") assert c is User_table.c.disk_usage - except Exception, e: + except Exception as e: print "Adding disk_usage column to galaxy_user table failed: %s" % str( e ) log.debug( "Adding disk_usage column to galaxy_user table failed: %s" % str( e ) ) @@ -49,7 +49,7 @@ def upgrade(migrate_engine): c = Column( 'disk_usage', Numeric( 15, 0 ), index=True ) c.create( GalaxySession_table, index_name="ix_galaxy_session_disk_usage") assert c is GalaxySession_table.c.disk_usage - except Exception, e: + except Exception as e: print "Adding disk_usage column to galaxy_session table failed: %s" % str( e ) log.debug( "Adding disk_usage column to galaxy_session table failed: %s" % str( e ) ) @@ -60,27 +60,27 @@ def downgrade(migrate_engine): try: Dataset_table = Table( "dataset", metadata, autoload=True ) Dataset_table.c.total_size.drop() - except Exception, e: + except Exception as e: print "Dropping total_size column from dataset table failed: %s" % str( e ) log.debug( "Dropping total_size column from dataset table failed: %s" % str( e ) ) try: HistoryDatasetAssociation_table = Table( "history_dataset_association", metadata, autoload=True ) HistoryDatasetAssociation_table.c.purged.drop() - except Exception, e: + except Exception as e: print "Dropping purged column from history_dataset_association table failed: %s" % str( e ) log.debug( "Dropping purged column from history_dataset_association table failed: %s" % str( e ) ) try: User_table = Table( "galaxy_user", metadata, autoload=True ) User_table.c.disk_usage.drop() - except Exception, e: + except Exception as e: print "Dropping disk_usage column from galaxy_user table failed: %s" % str( e ) log.debug( "Dropping disk_usage column from galaxy_user table failed: %s" % str( e ) ) try: GalaxySession_table = Table( "galaxy_session", metadata, autoload=True ) GalaxySession_table.c.disk_usage.drop() - except Exception, e: + except Exception as e: print "Dropping disk_usage column from galaxy_session table failed: %s" % str( e ) log.debug( "Dropping disk_usage column from galaxy_session table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0079_input_library_to_job_table.py b/lib/galaxy/model/migrate/versions/0079_input_library_to_job_table.py index d8dd928cde7..4cc0d6e0ab6 100644 --- a/lib/galaxy/model/migrate/versions/0079_input_library_to_job_table.py +++ b/lib/galaxy/model/migrate/versions/0079_input_library_to_job_table.py @@ -24,7 +24,7 @@ def upgrade(migrate_engine): # Create the job_to_input_library_dataset table try: JobToInputLibraryDatasetAssociation_table.create() - except Exception, e: + except Exception as e: print "Creating job_to_input_library_dataset table failed: %s" % str( e ) log.debug( "Creating job_to_input_library_dataset table failed: %s" % str( e ) ) @@ -36,6 +36,6 @@ def downgrade(migrate_engine): # Drop the job_to_input_library_dataset table try: JobToInputLibraryDatasetAssociation_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping job_to_input_library_dataset table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0080_quota_tables.py b/lib/galaxy/model/migrate/versions/0080_quota_tables.py index 352821797fe..5420a822f2d 100644 --- a/lib/galaxy/model/migrate/versions/0080_quota_tables.py +++ b/lib/galaxy/model/migrate/versions/0080_quota_tables.py @@ -52,25 +52,25 @@ def upgrade(migrate_engine): # Create quota table try: Quota_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating quota table failed: %s" % str( e ) ) # Create user_quota_association table try: UserQuotaAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating user_quota_association table failed: %s" % str( e ) ) # Create group_quota_association table try: GroupQuotaAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating group_quota_association table failed: %s" % str( e ) ) # Create default_quota_association table try: DefaultQuotaAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating default_quota_association table failed: %s" % str( e ) ) @@ -81,23 +81,23 @@ def downgrade(migrate_engine): # Drop default_quota_association table try: DefaultQuotaAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping default_quota_association table failed: %s" % str( e ) ) # Drop group_quota_association table try: GroupQuotaAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping group_quota_association table failed: %s" % str( e ) ) # Drop user_quota_association table try: UserQuotaAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping user_quota_association table failed: %s" % str( e ) ) # Drop quota table try: Quota_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping quota table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0081_add_tool_version_to_hda_ldda.py b/lib/galaxy/model/migrate/versions/0081_add_tool_version_to_hda_ldda.py index d1d8bea507d..d3781b9dc23 100644 --- a/lib/galaxy/model/migrate/versions/0081_add_tool_version_to_hda_ldda.py +++ b/lib/galaxy/model/migrate/versions/0081_add_tool_version_to_hda_ldda.py @@ -21,7 +21,7 @@ def upgrade(migrate_engine): c.create( ldda_table ) assert c is ldda_table.c.tool_version - except Exception, e: + except Exception as e: print "Adding the tool_version column to the hda/ldda tables failed: ", str( e ) @@ -34,5 +34,5 @@ def downgrade(migrate_engine): ldda_table = Table( "library_dataset_dataset_association", metadata, autoload=True ) ldda_table.c.tool_version.drop() - except Exception, e: + except Exception as e: print "Dropping the tool_version column from hda/ldda table failed: ", str( e ) diff --git a/lib/galaxy/model/migrate/versions/0082_add_tool_shed_repository_table.py b/lib/galaxy/model/migrate/versions/0082_add_tool_shed_repository_table.py index 50c9b0389e2..436576ebffa 100644 --- a/lib/galaxy/model/migrate/versions/0082_add_tool_shed_repository_table.py +++ b/lib/galaxy/model/migrate/versions/0082_add_tool_shed_repository_table.py @@ -40,7 +40,7 @@ def upgrade(migrate_engine): metadata.reflect() try: ToolShedRepository_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating tool_shed_repository table failed: %s" % str( e ) ) @@ -49,5 +49,5 @@ def downgrade(migrate_engine): metadata.reflect() try: ToolShedRepository_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping tool_shed_repository table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0083_add_prepare_files_to_task.py b/lib/galaxy/model/migrate/versions/0083_add_prepare_files_to_task.py index 5c0693a3860..2b9570818dd 100644 --- a/lib/galaxy/model/migrate/versions/0083_add_prepare_files_to_task.py +++ b/lib/galaxy/model/migrate/versions/0083_add_prepare_files_to_task.py @@ -18,7 +18,7 @@ def upgrade(migrate_engine): c = Column( "prepare_input_files_cmd", TEXT, nullable=True ) c.create( task_table ) assert c is task_table.c.prepare_input_files_cmd - except Exception, e: + except Exception as e: print "Adding prepare_input_files_cmd column to task table failed: %s" % str( e ) log.debug( "Adding prepare_input_files_cmd column to task table failed: %s" % str( e ) ) try: @@ -26,14 +26,14 @@ def upgrade(migrate_engine): c = Column( "working_directory", String( 1024 ), nullable=True ) c.create( task_table ) assert c is task_table.c.working_directory - except Exception, e: + except Exception as e: print "Adding working_directory column to task table failed: %s" % str( e ) log.debug( "Adding working_directory column to task table failed: %s" % str( e ) ) # remove the 'part_file' column - nobody used tasks before this, so no data needs to be migrated try: task_table.c.part_file.drop() - except Exception, e: + except Exception as e: log.debug( "Deleting column 'part_file' from the 'task' table failed: %s" % ( str( e ) ) ) @@ -43,13 +43,13 @@ def downgrade(migrate_engine): try: task_table = Table( "task", metadata, autoload=True ) task_table.c.prepare_input_files_cmd.drop() - except Exception, e: + except Exception as e: print "Dropping prepare_input_files_cmd column from task table failed: %s" % str( e ) log.debug( "Dropping prepare_input_files_cmd column from task table failed: %s" % str( e ) ) try: task_table = Table( "task", metadata, autoload=True ) task_table.c.working_directory.drop() - except Exception, e: + except Exception as e: print "Dropping working_directory column from task table failed: %s" % str( e ) log.debug( "Dropping working_directory column from task table failed: %s" % str( e ) ) try: @@ -57,6 +57,6 @@ def downgrade(migrate_engine): c = Column( "part_file", String( 1024 ), nullable=True ) c.create( task_table ) assert c is task_table.c.part_file - except Exception, e: + except Exception as e: print "Adding part_file column to task table failed: %s" % str( e ) log.debug( "Adding part_file column to task table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0084_add_ldda_id_to_implicit_conversion_table.py b/lib/galaxy/model/migrate/versions/0084_add_ldda_id_to_implicit_conversion_table.py index 29f2d590688..27ed7d01bbc 100644 --- a/lib/galaxy/model/migrate/versions/0084_add_ldda_id_to_implicit_conversion_table.py +++ b/lib/galaxy/model/migrate/versions/0084_add_ldda_id_to_implicit_conversion_table.py @@ -21,7 +21,7 @@ def upgrade(migrate_engine): c = Column( "ldda_id", Integer, index=True, nullable=True ) c.create( Implicitly_converted_table, index_name="ix_implicitly_converted_ds_assoc_ldda_id") assert c is Implicitly_converted_table.c.ldda_id - except Exception, e: + except Exception as e: print "Adding ldda_id column to implicitly_converted_dataset_association table failed: %s" % str( e ) log.debug( "Adding ldda_id column to implicitly_converted_dataset_association table failed: %s" % str( e ) ) @@ -32,6 +32,6 @@ def downgrade(migrate_engine): try: Implicitly_converted_table = Table( "implicitly_converted_dataset_association", metadata, autoload=True ) Implicitly_converted_table.c.ldda_id.drop() - except Exception, e: + except Exception as e: print "Dropping ldda_id column from implicitly_converted_dataset_association table failed: %s" % str( e ) log.debug( "Dropping ldda_id column from implicitly_converted_dataset_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0085_add_task_info.py b/lib/galaxy/model/migrate/versions/0085_add_task_info.py index 54ee37c1438..ffdce7b5c32 100644 --- a/lib/galaxy/model/migrate/versions/0085_add_task_info.py +++ b/lib/galaxy/model/migrate/versions/0085_add_task_info.py @@ -20,7 +20,7 @@ def upgrade(migrate_engine): c = Column( "info", TrimmedString(255), nullable=True ) c.create( task_table ) assert c is task_table.c.info - except Exception, e: + except Exception as e: print "Adding info column to table table failed: %s" % str( e ) log.debug( "Adding info column to task table failed: %s" % str( e ) ) @@ -31,6 +31,6 @@ def downgrade(migrate_engine): try: task_table = Table( "task", metadata, autoload=True ) task_table.c.info.drop() - except Exception, e: + except Exception as e: print "Dropping info column from task table failed: %s" % str( e ) log.debug( "Dropping info column from task table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0086_add_tool_shed_repository_table_columns.py b/lib/galaxy/model/migrate/versions/0086_add_tool_shed_repository_table_columns.py index da2ffda0802..7c48f8400b4 100644 --- a/lib/galaxy/model/migrate/versions/0086_add_tool_shed_repository_table_columns.py +++ b/lib/galaxy/model/migrate/versions/0086_add_tool_shed_repository_table_columns.py @@ -38,7 +38,7 @@ def upgrade(migrate_engine): try: c.create( ToolShedRepository_table ) assert c is ToolShedRepository_table.c.metadata - except Exception, e: + except Exception as e: print "Adding metadata column to the tool_shed_repository table failed: %s" % str( e ) log.debug( "Adding metadata column to the tool_shed_repository table failed: %s" % str( e ) ) c = Column( "includes_datatypes", Boolean, index=True, default=False ) @@ -46,7 +46,7 @@ def upgrade(migrate_engine): c.create( ToolShedRepository_table, index_name="ix_tool_shed_repository_includes_datatypes") assert c is ToolShedRepository_table.c.includes_datatypes migrate_engine.execute( "UPDATE tool_shed_repository SET includes_datatypes=%s" % get_default_false(migrate_engine)) - except Exception, e: + except Exception as e: print "Adding includes_datatypes column to the tool_shed_repository table failed: %s" % str( e ) log.debug( "Adding includes_datatypes column to the tool_shed_repository table failed: %s" % str( e ) ) c = Column( "update_available", Boolean, default=False ) @@ -54,7 +54,7 @@ def upgrade(migrate_engine): c.create( ToolShedRepository_table ) assert c is ToolShedRepository_table.c.update_available migrate_engine.execute( "UPDATE tool_shed_repository SET update_available=%s" % get_default_false(migrate_engine)) - except Exception, e: + except Exception as e: print "Adding update_available column to the tool_shed_repository table failed: %s" % str( e ) log.debug( "Adding update_available column to the tool_shed_repository table failed: %s" % str( e ) ) @@ -65,16 +65,16 @@ def downgrade(migrate_engine): ToolShedRepository_table = Table( "tool_shed_repository", metadata, autoload=True ) try: ToolShedRepository_table.c.metadata.drop() - except Exception, e: + except Exception as e: print "Dropping column metadata from the tool_shed_repository table failed: %s" % str( e ) log.debug( "Dropping column metadata from the tool_shed_repository table failed: %s" % str( e ) ) try: ToolShedRepository_table.c.includes_datatypes.drop() - except Exception, e: + except Exception as e: print "Dropping column includes_datatypes from the tool_shed_repository table failed: %s" % str( e ) log.debug( "Dropping column includes_datatypes from the tool_shed_repository table failed: %s" % str( e ) ) try: ToolShedRepository_table.c.update_available.drop() - except Exception, e: + except Exception as e: print "Dropping column update_available from the tool_shed_repository table failed: %s" % str( e ) log.debug( "Dropping column update_available from the tool_shed_repository table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0087_tool_id_guid_map_table.py b/lib/galaxy/model/migrate/versions/0087_tool_id_guid_map_table.py index bfba9e0c6b8..b7bdc756799 100644 --- a/lib/galaxy/model/migrate/versions/0087_tool_id_guid_map_table.py +++ b/lib/galaxy/model/migrate/versions/0087_tool_id_guid_map_table.py @@ -39,7 +39,7 @@ def upgrade(migrate_engine): metadata.reflect() try: ToolIdGuidMap_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating tool_id_guid_map table failed: %s" % str( e ) ) @@ -48,5 +48,5 @@ def downgrade(migrate_engine): metadata.reflect() try: ToolIdGuidMap_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping tool_id_guid_map table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0088_add_installed_changeset_revison_column.py b/lib/galaxy/model/migrate/versions/0088_add_installed_changeset_revison_column.py index 9e4641ee439..e12d721050b 100644 --- a/lib/galaxy/model/migrate/versions/0088_add_installed_changeset_revison_column.py +++ b/lib/galaxy/model/migrate/versions/0088_add_installed_changeset_revison_column.py @@ -31,7 +31,7 @@ def upgrade(migrate_engine): try: col.create( ToolShedRepository_table ) assert col is ToolShedRepository_table.c.installed_changeset_revision - except Exception, e: + except Exception as e: print "Adding installed_changeset_revision column to the tool_shed_repository table failed: %s" % str( e ) log.debug( "Adding installed_changeset_revision column to the tool_shed_repository table failed: %s" % str( e ) ) # Update each row by setting the value of installed_changeset_revison to be the value of changeset_revision. @@ -60,6 +60,6 @@ def downgrade(migrate_engine): ToolShedRepository_table = Table( "tool_shed_repository", metadata, autoload=True ) try: ToolShedRepository_table.c.installed_changeset_revision.drop() - except Exception, e: + except Exception as e: print "Dropping column installed_changeset_revision from the tool_shed_repository table failed: %s" % str( e ) log.debug( "Dropping column installed_changeset_revision from the tool_shed_repository table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0089_add_object_store_id_columns.py b/lib/galaxy/model/migrate/versions/0089_add_object_store_id_columns.py index e146a126538..efabbd5ab26 100644 --- a/lib/galaxy/model/migrate/versions/0089_add_object_store_id_columns.py +++ b/lib/galaxy/model/migrate/versions/0089_add_object_store_id_columns.py @@ -21,7 +21,7 @@ def upgrade(migrate_engine): try: c.create( t, index_name="ix_%s_object_store_id" % t_name) assert c is t.c.object_store_id - except Exception, e: + except Exception as e: print "Adding object_store_id column to %s table failed: %s" % ( t_name, str( e ) ) log.debug( "Adding object_store_id column to %s table failed: %s" % ( t_name, str( e ) ) ) @@ -33,6 +33,6 @@ def downgrade(migrate_engine): t = Table( t_name, metadata, autoload=True ) try: t.c.object_store_id.drop() - except Exception, e: + except Exception as e: print "Dropping object_store_id column from %s table failed: %s" % ( t_name, str( e ) ) log.debug( "Dropping object_store_id column from %s table failed: %s" % ( t_name, str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0090_add_tool_shed_repository_table_columns.py b/lib/galaxy/model/migrate/versions/0090_add_tool_shed_repository_table_columns.py index 14d13bbf8ba..eb209758ba5 100644 --- a/lib/galaxy/model/migrate/versions/0090_add_tool_shed_repository_table_columns.py +++ b/lib/galaxy/model/migrate/versions/0090_add_tool_shed_repository_table_columns.py @@ -36,14 +36,14 @@ def upgrade(migrate_engine): c.create( ToolShedRepository_table ) assert c is ToolShedRepository_table.c.uninstalled migrate_engine.execute( "UPDATE tool_shed_repository SET uninstalled=%s" % default_false(migrate_engine) ) - except Exception, e: + except Exception as e: print "Adding uninstalled column to the tool_shed_repository table failed: %s" % str( e ) c = Column( "dist_to_shed", Boolean, default=False ) try: c.create( ToolShedRepository_table ) assert c is ToolShedRepository_table.c.dist_to_shed migrate_engine.execute( "UPDATE tool_shed_repository SET dist_to_shed=%s" % default_false(migrate_engine) ) - except Exception, e: + except Exception as e: print "Adding dist_to_shed column to the tool_shed_repository table failed: %s" % str( e ) @@ -53,9 +53,9 @@ def downgrade(migrate_engine): ToolShedRepository_table = Table( "tool_shed_repository", metadata, autoload=True ) try: ToolShedRepository_table.c.uninstalled.drop() - except Exception, e: + except Exception as e: print "Dropping column uninstalled from the tool_shed_repository table failed: %s" % str( e ) try: ToolShedRepository_table.c.dist_to_shed.drop() - except Exception, e: + except Exception as e: print "Dropping column dist_to_shed from the tool_shed_repository table failed: %s" % str( e ) diff --git a/lib/galaxy/model/migrate/versions/0091_add_tool_version_tables.py b/lib/galaxy/model/migrate/versions/0091_add_tool_version_tables.py index 50ed32c10a2..cf2967315c0 100644 --- a/lib/galaxy/model/migrate/versions/0091_add_tool_version_tables.py +++ b/lib/galaxy/model/migrate/versions/0091_add_tool_version_tables.py @@ -63,11 +63,11 @@ def upgrade(migrate_engine): # Create the tables. try: ToolVersion_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating tool_version table failed: %s" % str( e ) ) try: ToolVersionAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating tool_version_association table failed: %s" % str( e ) ) # Populate the tool table with tools included in installed tool shed repositories. cmd = "SELECT id, metadata FROM tool_shed_repository" @@ -89,7 +89,7 @@ def upgrade(migrate_engine): # Drop the tool_id_guid_map table since the 2 new tables render it unnecessary. try: ToolIdGuidMap_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping tool_id_guid_map table failed: %s" % str( e ) ) @@ -110,13 +110,13 @@ def downgrade(migrate_engine): metadata.reflect() try: ToolVersionAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping tool_version_association table failed: %s" % str( e ) ) try: ToolVersion_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping tool_version table failed: %s" % str( e ) ) try: ToolIdGuidMap_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating tool_id_guid_map table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0092_add_migrate_tools_table.py b/lib/galaxy/model/migrate/versions/0092_add_migrate_tools_table.py index b8b00eafff0..af5b8afa1f2 100644 --- a/lib/galaxy/model/migrate/versions/0092_add_migrate_tools_table.py +++ b/lib/galaxy/model/migrate/versions/0092_add_migrate_tools_table.py @@ -37,7 +37,7 @@ def upgrade(migrate_engine): MigrateTools_table.create() cmd = "INSERT INTO migrate_tools VALUES ('GalaxyTools', 'lib/galaxy/tool_shed/migrate', %d)" % 1 migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "Creating migrate_tools table failed: %s" % str( e ) ) @@ -46,5 +46,5 @@ def downgrade(migrate_engine): metadata.reflect() try: MigrateTools_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping migrate_tools table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0093_add_job_params_col.py b/lib/galaxy/model/migrate/versions/0093_add_job_params_col.py index 34ae580da50..c8e6d607ced 100644 --- a/lib/galaxy/model/migrate/versions/0093_add_job_params_col.py +++ b/lib/galaxy/model/migrate/versions/0093_add_job_params_col.py @@ -31,7 +31,7 @@ def upgrade(migrate_engine): params_col.create( Job_table, index_name="ix_job_params") assert params_col is Job_table.c.params - except Exception, e: + except Exception as e: print str(e) log.debug( "Adding column 'params' to job table failed: %s" % str( e ) ) @@ -45,5 +45,5 @@ def downgrade(migrate_engine): Job_table = Table( "job", metadata, autoload=True ) params_col = Job_table.c.params params_col.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping column 'params' from job table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0094_add_job_handler_col.py b/lib/galaxy/model/migrate/versions/0094_add_job_handler_col.py index ba074730f5d..0d996fe6e58 100644 --- a/lib/galaxy/model/migrate/versions/0094_add_job_handler_col.py +++ b/lib/galaxy/model/migrate/versions/0094_add_job_handler_col.py @@ -31,7 +31,7 @@ def upgrade(migrate_engine): handler_col.create( Job_table, index_name="ix_job_handler" ) assert handler_col is Job_table.c.handler - except Exception, e: + except Exception as e: print str(e) log.debug( "Adding column 'handler' to job table failed: %s" % str( e ) ) @@ -45,5 +45,5 @@ def downgrade(migrate_engine): Job_table = Table( "job", metadata, autoload=True ) handler_col = Job_table.c.handler handler_col.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping column 'handler' from job table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0095_hda_subsets.py b/lib/galaxy/model/migrate/versions/0095_hda_subsets.py index 8dadc1dcc08..3ca255eb23c 100644 --- a/lib/galaxy/model/migrate/versions/0095_hda_subsets.py +++ b/lib/galaxy/model/migrate/versions/0095_hda_subsets.py @@ -25,7 +25,7 @@ def upgrade(migrate_engine): # Create history_dataset_association_subset. try: HistoryDatasetAssociationSubset_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating history_dataset_association_subset table failed: %s" % str( e ) ) @@ -35,7 +35,7 @@ def upgrade(migrate_engine): try: i1.create() i2.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Adding indices to table 'history_dataset_association_subset' table failed: %s" % str( e ) ) @@ -47,6 +47,6 @@ def downgrade(migrate_engine): # Drop history_dataset_association_subset table. try: HistoryDatasetAssociationSubset_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping history_dataset_association_subset table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0096_openid_provider.py b/lib/galaxy/model/migrate/versions/0096_openid_provider.py index 52d7a1df8b2..89792e5cd46 100644 --- a/lib/galaxy/model/migrate/versions/0096_openid_provider.py +++ b/lib/galaxy/model/migrate/versions/0096_openid_provider.py @@ -23,14 +23,14 @@ def upgrade(migrate_engine): c = Column( "provider", TrimmedString( 255 ) ) c.create( OpenID_table ) assert c is OpenID_table.c.provider - except Exception, e: + except Exception as e: print "Adding provider column to galaxy_user_openid table failed: %s" % str( e ) log.debug( "Adding provider column to galaxy_user_openid table failed: %s" % str( e ) ) try: cmd = "DELETE FROM galaxy_user_openid WHERE openid='%s'" % ( BAD_IDENTIFIER ) migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "Deleting bad Identifiers from galaxy_user_openid failed: %s" % str( e ) ) @@ -40,6 +40,6 @@ def downgrade(migrate_engine): try: OpenID_table = Table( "galaxy_user_openid", metadata, autoload=True ) OpenID_table.c.provider.drop() - except Exception, e: + except Exception as e: print "Dropping provider column from galaxy_user_openid table failed: %s" % str( e ) log.debug( "Dropping provider column from galaxy_user_openid table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0097_add_ctx_rev_column.py b/lib/galaxy/model/migrate/versions/0097_add_ctx_rev_column.py index b2cf86cd98f..10076ae2ed8 100644 --- a/lib/galaxy/model/migrate/versions/0097_add_ctx_rev_column.py +++ b/lib/galaxy/model/migrate/versions/0097_add_ctx_rev_column.py @@ -31,7 +31,7 @@ def upgrade(migrate_engine): try: col.create( ToolShedRepository_table ) assert col is ToolShedRepository_table.c.ctx_rev - except Exception, e: + except Exception as e: print "Adding ctx_rev column to the tool_shed_repository table failed: %s" % str( e ) @@ -41,5 +41,5 @@ def downgrade(migrate_engine): ToolShedRepository_table = Table( "tool_shed_repository", metadata, autoload=True ) try: ToolShedRepository_table.c.ctx_rev.drop() - except Exception, e: + except Exception as e: print "Dropping column ctx_rev from the tool_shed_repository table failed: %s" % str( e ) diff --git a/lib/galaxy/model/migrate/versions/0098_genome_index_tool_data_table.py b/lib/galaxy/model/migrate/versions/0098_genome_index_tool_data_table.py index 8becd71717c..dd86fd290a6 100644 --- a/lib/galaxy/model/migrate/versions/0098_genome_index_tool_data_table.py +++ b/lib/galaxy/model/migrate/versions/0098_genome_index_tool_data_table.py @@ -39,7 +39,7 @@ def upgrade(migrate_engine): metadata.reflect() try: GenomeIndexToolData_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating genome_index_tool_data table failed: %s" % str( e ) ) @@ -48,5 +48,5 @@ def downgrade(migrate_engine): metadata.reflect() try: GenomeIndexToolData_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping genome_index_tool_data table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0099_add_tool_dependency_table.py b/lib/galaxy/model/migrate/versions/0099_add_tool_dependency_table.py index c36fd5856f0..f04f19282f3 100644 --- a/lib/galaxy/model/migrate/versions/0099_add_tool_dependency_table.py +++ b/lib/galaxy/model/migrate/versions/0099_add_tool_dependency_table.py @@ -39,7 +39,7 @@ def upgrade(migrate_engine): metadata.reflect() try: ToolDependency_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating tool_dependency table failed: %s" % str( e ) ) @@ -48,5 +48,5 @@ def downgrade(migrate_engine): metadata.reflect() try: ToolDependency_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping tool_dependency table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0100_alter_tool_dependency_table_version_column.py b/lib/galaxy/model/migrate/versions/0100_alter_tool_dependency_table_version_column.py index a79315c2778..eefe3b0330e 100644 --- a/lib/galaxy/model/migrate/versions/0100_alter_tool_dependency_table_version_column.py +++ b/lib/galaxy/model/migrate/versions/0100_alter_tool_dependency_table_version_column.py @@ -41,7 +41,7 @@ def upgrade(migrate_engine): if cmd: try: migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "Altering tool_dependency.version column from TrimmedString(40) to Text failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0101_drop_installed_changeset_revision_column.py b/lib/galaxy/model/migrate/versions/0101_drop_installed_changeset_revision_column.py index 982065ffb26..a5aaf627fed 100644 --- a/lib/galaxy/model/migrate/versions/0101_drop_installed_changeset_revision_column.py +++ b/lib/galaxy/model/migrate/versions/0101_drop_installed_changeset_revision_column.py @@ -33,7 +33,7 @@ def upgrade(migrate_engine): try: col = ToolDependency_table.c.installed_changeset_revision col.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping column 'installed_changeset_revision' from tool_dependency table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0102_add_tool_dependency_status_columns.py b/lib/galaxy/model/migrate/versions/0102_add_tool_dependency_status_columns.py index 24b3802c597..45887cb0584 100644 --- a/lib/galaxy/model/migrate/versions/0102_add_tool_dependency_status_columns.py +++ b/lib/galaxy/model/migrate/versions/0102_add_tool_dependency_status_columns.py @@ -34,13 +34,13 @@ def upgrade(migrate_engine): try: col.create( ToolDependency_table ) assert col is ToolDependency_table.c.status - except Exception, e: + except Exception as e: print "Adding status column to the tool_dependency table failed: %s" % str( e ) col = Column( "error_message", TEXT ) try: col.create( ToolDependency_table ) assert col is ToolDependency_table.c.error_message - except Exception, e: + except Exception as e: print "Adding error_message column to the tool_dependency table failed: %s" % str( e ) if migrate_engine.name != 'sqlite': @@ -48,7 +48,7 @@ def upgrade(migrate_engine): # TODO move to alembic. try: ToolDependency_table.c.uninstalled.drop() - except Exception, e: + except Exception as e: print "Dropping uninstalled column from the tool_dependency table failed: %s" % str( e ) @@ -58,15 +58,15 @@ def downgrade(migrate_engine): ToolDependency_table = Table( "tool_dependency", metadata, autoload=True ) try: ToolDependency_table.c.status.drop() - except Exception, e: + except Exception as e: print "Dropping column status from the tool_dependency table failed: %s" % str( e ) try: ToolDependency_table.c.error_message.drop() - except Exception, e: + except Exception as e: print "Dropping column error_message from the tool_dependency table failed: %s" % str( e ) col = Column( "uninstalled", Boolean, default=False ) try: col.create( ToolDependency_table ) assert col is ToolDependency_table.c.uninstalled - except Exception, e: + except Exception as e: print "Adding uninstalled column to the tool_dependency table failed: %s" % str( e ) diff --git a/lib/galaxy/model/migrate/versions/0103_add_tool_shed_repository_status_columns.py b/lib/galaxy/model/migrate/versions/0103_add_tool_shed_repository_status_columns.py index 4e8a0e7dde1..a9a2e963c90 100644 --- a/lib/galaxy/model/migrate/versions/0103_add_tool_shed_repository_status_columns.py +++ b/lib/galaxy/model/migrate/versions/0103_add_tool_shed_repository_status_columns.py @@ -20,20 +20,20 @@ def upgrade(migrate_engine): try: col.create( ToolShedRepository_table ) assert col is ToolShedRepository_table.c.status - except Exception, e: + except Exception as e: print "Adding status column to the tool_shed_repository table failed: %s" % str( e ) # Add the error_message column to the tool_shed_repository table. col = Column( "error_message", TEXT ) try: col.create( ToolShedRepository_table ) assert col is ToolShedRepository_table.c.error_message - except Exception, e: + except Exception as e: print "Adding error_message column to the tool_shed_repository table failed: %s" % str( e ) # Update the status column value for tool_shed_repositories to the default value 'Installed'. cmd = "UPDATE tool_shed_repository SET status = 'Installed';" try: migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: print "Exception executing sql command: " print cmd print str( e ) @@ -41,7 +41,7 @@ def upgrade(migrate_engine): cmd = "UPDATE tool_shed_repository SET status = 'Uninstalled' WHERE uninstalled;" try: migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: print "Exception executing sql command: " print cmd print str( e ) @@ -49,7 +49,7 @@ def upgrade(migrate_engine): cmd = "UPDATE tool_shed_repository SET status = 'Deactivated' where deleted and not uninstalled;" try: migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: print "Exception executing sql command: " print cmd print str( e ) @@ -61,9 +61,9 @@ def downgrade(migrate_engine): ToolShedRepository_table = Table( "tool_shed_repository", metadata, autoload=True ) try: ToolShedRepository_table.c.status.drop() - except Exception, e: + except Exception as e: print "Dropping column status from the tool_shed_repository table failed: %s" % str( e ) try: ToolShedRepository_table.c.error_message.drop() - except Exception, e: + except Exception as e: print "Dropping column error_message from the tool_shed_repository table failed: %s" % str( e ) diff --git a/lib/galaxy/model/migrate/versions/0105_add_cleanup_event_table.py b/lib/galaxy/model/migrate/versions/0105_add_cleanup_event_table.py index 0a99a18c6f2..adfcd25c971 100644 --- a/lib/galaxy/model/migrate/versions/0105_add_cleanup_event_table.py +++ b/lib/galaxy/model/migrate/versions/0105_add_cleanup_event_table.py @@ -96,7 +96,7 @@ def upgrade(migrate_engine): CleanupEventLibraryDatasetAssociation_table.create() CleanupEventLibraryDatasetDatasetAssociationAssociation_table.create() CleanupEventImplicitlyConvertedDatasetAssociationAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating table failed: %s" % str( e ) ) @@ -114,5 +114,5 @@ def downgrade(migrate_engine): CleanupEventMetadataFileAssociation_table.drop() CleanupEventDatasetAssociation_table.drop() CleanupEvent_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0106_add_missing_indexes.py b/lib/galaxy/model/migrate/versions/0106_add_missing_indexes.py index 0bf4922b4c4..b237c8929b6 100644 --- a/lib/galaxy/model/migrate/versions/0106_add_missing_indexes.py +++ b/lib/galaxy/model/migrate/versions/0106_add_missing_indexes.py @@ -62,7 +62,7 @@ def upgrade(migrate_engine): Index( ix, t.c[col] ).create() else: pass # Index already exists, don't recreate. - except Exception, e: + except Exception as e: log.error("Unable to create index '%s': %s" % (ix, str(e))) @@ -75,5 +75,5 @@ def downgrade(migrate_engine): try: t = Table( table, metadata, autoload=True ) Index( ix, t.c[col] ).drop() - except Exception, e: + except Exception as e: log.error("Unable to drop index '%s': %s" % (ix, str(e))) diff --git a/lib/galaxy/model/migrate/versions/0107_add_exit_code_to_job_and_task.py b/lib/galaxy/model/migrate/versions/0107_add_exit_code_to_job_and_task.py index e68f355be30..305c2031b5f 100644 --- a/lib/galaxy/model/migrate/versions/0107_add_exit_code_to_job_and_task.py +++ b/lib/galaxy/model/migrate/versions/0107_add_exit_code_to_job_and_task.py @@ -29,7 +29,7 @@ def upgrade(migrate_engine): job_table = Table( "job", metadata, autoload=True ) exit_code_job_col.create( job_table ) assert exit_code_job_col is job_table.c.exit_code - except Exception, e: + except Exception as e: print str(e) log.error( "Adding column 'exit_code' to job table failed: %s" % str( e ) ) return @@ -39,7 +39,7 @@ def upgrade(migrate_engine): task_table = Table( "task", metadata, autoload=True ) exit_code_task_col.create( task_table ) assert exit_code_task_col is task_table.c.exit_code - except Exception, e: + except Exception as e: print str(e) log.error( "Adding column 'exit_code' to task table failed: %s" % str( e ) ) return @@ -54,7 +54,7 @@ def downgrade(migrate_engine): job_table = Table( "job", metadata, autoload=True ) exit_code_col = job_table.c.exit_code exit_code_col.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping 'exit_code' column from job table failed: %s" % ( str( e ) ) ) # Drop the Job table's exit_code column. @@ -62,5 +62,5 @@ def downgrade(migrate_engine): task_table = Table( "task", metadata, autoload=True ) exit_code_col = task_table.c.exit_code exit_code_col.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping 'exit_code' column from task table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0108_add_extended_metadata.py b/lib/galaxy/model/migrate/versions/0108_add_extended_metadata.py index 5da8e18e51f..958bfefb859 100644 --- a/lib/galaxy/model/migrate/versions/0108_add_extended_metadata.py +++ b/lib/galaxy/model/migrate/versions/0108_add_extended_metadata.py @@ -47,7 +47,7 @@ def upgrade(migrate_engine): ldda_table = Table( "library_dataset_dataset_association", metadata, autoload=True ) extended_metadata_ldda_col.create( ldda_table ) assert extended_metadata_ldda_col is ldda_table.c.extended_metadata_id - except Exception, e: + except Exception as e: print str(e) log.error( "Adding column 'extended_metadata_id' to library_dataset_dataset_association table failed: %s" % str( e ) ) @@ -57,12 +57,12 @@ def downgrade(migrate_engine): metadata.reflect() try: ExtendedMetadataIndex_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping 'extended_metadata_index' table failed: %s" % ( str( e ) ) ) try: ExtendedMetadata_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping 'extended_metadata' table failed: %s" % ( str( e ) ) ) # Drop the LDDA table's extended metadata ID column. @@ -70,5 +70,5 @@ def downgrade(migrate_engine): ldda_table = Table( "library_dataset_dataset_association", metadata, autoload=True ) extended_metadata_id = ldda_table.c.extended_metadata_id extended_metadata_id.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping 'extended_metadata_id' column from library_dataset_dataset_association table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0109_add_repository_dependency_tables.py b/lib/galaxy/model/migrate/versions/0109_add_repository_dependency_tables.py index 32138cb8b12..49016323c05 100644 --- a/lib/galaxy/model/migrate/versions/0109_add_repository_dependency_tables.py +++ b/lib/galaxy/model/migrate/versions/0109_add_repository_dependency_tables.py @@ -38,11 +38,11 @@ def upgrade(migrate_engine): metadata.reflect() try: RepositoryDependency_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating repository_dependency table failed: %s" % str( e ) ) try: RepositoryRepositoryDependencyAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating repository_repository_dependency_association table failed: %s" % str( e ) ) @@ -51,9 +51,9 @@ def downgrade(migrate_engine): metadata.reflect() try: RepositoryRepositoryDependencyAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping repository_repository_dependency_association table failed: %s" % str( e ) ) try: RepositoryDependency_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping repository_dependency table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0110_add_dataset_uuid.py b/lib/galaxy/model/migrate/versions/0110_add_dataset_uuid.py index d6eed4e5413..2b32fec29ed 100644 --- a/lib/galaxy/model/migrate/versions/0110_add_dataset_uuid.py +++ b/lib/galaxy/model/migrate/versions/0110_add_dataset_uuid.py @@ -27,7 +27,7 @@ def upgrade(migrate_engine): dataset_table = Table( "dataset", metadata, autoload=True ) dataset_uuid_column.create( dataset_table ) assert dataset_uuid_column is dataset_table.c.uuid - except Exception, e: + except Exception as e: print str(e) log.error( "Adding column 'uuid' to dataset table failed: %s" % str( e ) ) return @@ -43,5 +43,5 @@ def downgrade(migrate_engine): dataset_table = Table( "dataset", metadata, autoload=True ) dataset_uuid = dataset_table.c.uuid dataset_uuid.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping 'uuid' column from dataset table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0111_add_job_destinations.py b/lib/galaxy/model/migrate/versions/0111_add_job_destinations.py index af2196a86f7..4eb8b6b89a5 100644 --- a/lib/galaxy/model/migrate/versions/0111_add_job_destinations.py +++ b/lib/galaxy/model/migrate/versions/0111_add_job_destinations.py @@ -26,14 +26,14 @@ def upgrade(migrate_engine): try: c.create( Job_table ) assert c is Job_table.c.destination_id - except Exception, e: + except Exception as e: log.error( "Adding column 'destination_id' to job table failed: %s" % str( e ) ) c = Column( "destination_params", JSONType, nullable=True ) try: c.create( Job_table ) assert c is Job_table.c.destination_params - except Exception, e: + except Exception as e: log.error( "Adding column 'destination_params' to job table failed: %s" % str( e ) ) @@ -45,10 +45,10 @@ def downgrade(migrate_engine): try: Job_table.c.destination_params.drop() - except Exception, e: + except Exception as e: log.error( "Dropping column 'destination_params' from job table failed: %s" % str( e ) ) try: Job_table.c.destination_id.drop() - except Exception, e: + except Exception as e: log.error( "Dropping column 'destination_id' from job table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0112_add_data_manager_history_association_and_data_manager_job_association_tables.py b/lib/galaxy/model/migrate/versions/0112_add_data_manager_history_association_and_data_manager_job_association_tables.py index 9a37fdb5bb7..0e63ffeba1e 100644 --- a/lib/galaxy/model/migrate/versions/0112_add_data_manager_history_association_and_data_manager_job_association_tables.py +++ b/lib/galaxy/model/migrate/versions/0112_add_data_manager_history_association_and_data_manager_job_association_tables.py @@ -33,12 +33,12 @@ def upgrade(migrate_engine): try: DataManagerHistoryAssociation_table.create() log.debug( "Created data_manager_history_association table" ) - except Exception, e: + except Exception as e: log.debug( "Creating data_manager_history_association table failed: %s" % str( e ) ) try: DataManagerJobAssociation_table.create() log.debug( "Created data_manager_job_association table" ) - except Exception, e: + except Exception as e: log.debug( "Creating data_manager_job_association table failed: %s" % str( e ) ) @@ -48,10 +48,10 @@ def downgrade(migrate_engine): try: DataManagerHistoryAssociation_table.drop() log.debug( "Dropped data_manager_history_association table" ) - except Exception, e: + except Exception as e: log.debug( "Dropping data_manager_history_association table failed: %s" % str( e ) ) try: DataManagerJobAssociation_table.drop() log.debug( "Dropped data_manager_job_association table" ) - except Exception, e: + except Exception as e: log.debug( "Dropping data_manager_job_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0113_update_migrate_tools_table.py b/lib/galaxy/model/migrate/versions/0113_update_migrate_tools_table.py index e8835131667..c6a1c1ed03d 100644 --- a/lib/galaxy/model/migrate/versions/0113_update_migrate_tools_table.py +++ b/lib/galaxy/model/migrate/versions/0113_update_migrate_tools_table.py @@ -21,7 +21,7 @@ def upgrade(migrate_engine): try: cmd = "UPDATE migrate_tools set repository_path='lib/galaxy/tool_shed/migrate';" migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "Updating migrate_tools.repository_path column to point to the new location lib/tool_shed/galaxy_install/migrate failed: %s" % str( e ) ) @@ -29,5 +29,5 @@ def downgrade(migrate_engine): try: cmd = "UPDATE migrate_tools set repository_path='lib/galaxy/tool_shed/migrate';" migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "Updating migrate_tools.repository_path column to point to the old location lib/galaxy/tool_shed/migrate failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0114_update_migrate_tools_table_again.py b/lib/galaxy/model/migrate/versions/0114_update_migrate_tools_table_again.py index 55902c1c816..f54fd9934d2 100644 --- a/lib/galaxy/model/migrate/versions/0114_update_migrate_tools_table_again.py +++ b/lib/galaxy/model/migrate/versions/0114_update_migrate_tools_table_again.py @@ -21,7 +21,7 @@ def upgrade(migrate_engine): try: cmd = "UPDATE migrate_tools set repository_path='lib/tool_shed/galaxy_install/migrate';" migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "Updating migrate_tools.repository_path column to point to the new location lib/tool_shed/galaxy_install/migrate failed: %s" % str( e ) ) @@ -29,5 +29,5 @@ def downgrade(migrate_engine): try: cmd = "UPDATE migrate_tools set repository_path='lib/galaxy/tool_shed/migrate';" migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "Updating migrate_tools.repository_path column to point to the old location lib/galaxy/tool_shed/migrate failed: %s" % str( e ) ) diff --git a/lib/galaxy/model/migrate/versions/0116_drop_update_available_col_add_tool_shed_status_col.py b/lib/galaxy/model/migrate/versions/0116_drop_update_available_col_add_tool_shed_status_col.py index 7d3017b0c07..830f8cd12bf 100644 --- a/lib/galaxy/model/migrate/versions/0116_drop_update_available_col_add_tool_shed_status_col.py +++ b/lib/galaxy/model/migrate/versions/0116_drop_update_available_col_add_tool_shed_status_col.py @@ -44,13 +44,13 @@ def upgrade( migrate_engine ): try: col = ToolShedRepository_table.c.update_available col.drop() - except Exception, e: + except Exception as e: print "Dropping column update_available from the tool_shed_repository table failed: %s" % str( e ) c = Column( "tool_shed_status", JSONType, nullable=True ) try: c.create( ToolShedRepository_table ) assert c is ToolShedRepository_table.c.tool_shed_status - except Exception, e: + except Exception as e: print "Adding tool_shed_status column to the tool_shed_repository table failed: %s" % str( e ) @@ -68,12 +68,12 @@ def downgrade( migrate_engine ): try: col = ToolShedRepository_table.c.tool_shed_status col.drop() - except Exception, e: + except Exception as e: print "Dropping column tool_shed_status from the tool_shed_repository table failed: %s" % str( e ) c = Column( "update_available", Boolean, default=False ) try: c.create( ToolShedRepository_table ) assert c is ToolShedRepository_table.c.update_available migrate_engine.execute( "UPDATE tool_shed_repository SET update_available=%s" % default_false( migrate_engine ) ) - except Exception, e: + except Exception as e: print "Adding column update_available to the tool_shed_repository table failed: %s" % str( e ) diff --git a/lib/galaxy/model/migrate/versions/0117_add_user_activation.py b/lib/galaxy/model/migrate/versions/0117_add_user_activation.py index 72483ac1c7e..28c618b3e60 100644 --- a/lib/galaxy/model/migrate/versions/0117_add_user_activation.py +++ b/lib/galaxy/model/migrate/versions/0117_add_user_activation.py @@ -34,7 +34,7 @@ def upgrade(migrate_engine): user_activation_token_column.create( table=user_table ) assert user_active_column is user_table.c.active assert user_activation_token_column is user_table.c.activation_token - except Exception, e: + except Exception as e: print str(e) log.error( "Adding columns 'active' and 'activation_token' to galaxy_user table failed: %s" % str( e ) ) return @@ -52,5 +52,5 @@ def downgrade(migrate_engine): user_activation_token = user_table.c.activation_token user_active.drop() user_activation_token.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping 'active' and 'activation_token' columns from galaxy_user table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0118_add_hda_extended_metadata.py b/lib/galaxy/model/migrate/versions/0118_add_hda_extended_metadata.py index 3642fe41810..f846ec5e44e 100644 --- a/lib/galaxy/model/migrate/versions/0118_add_hda_extended_metadata.py +++ b/lib/galaxy/model/migrate/versions/0118_add_hda_extended_metadata.py @@ -23,7 +23,7 @@ def upgrade(migrate_engine): hda_table = Table( "history_dataset_association", metadata, autoload=True ) extended_metadata_hda_col.create( hda_table ) assert extended_metadata_hda_col is hda_table.c.extended_metadata_id - except Exception, e: + except Exception as e: print str(e) log.error( "Adding column 'extended_metadata_id' to history_dataset_association table failed: %s" % str( e ) ) @@ -37,5 +37,5 @@ def downgrade(migrate_engine): hda_table = Table( "history_dataset_association", metadata, autoload=True ) extended_metadata_id = hda_table.c.extended_metadata_id extended_metadata_id.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping 'extended_metadata_id' column from history_dataset_association table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0121_workflow_uuids.py b/lib/galaxy/model/migrate/versions/0121_workflow_uuids.py index 86df373d47d..6075b34bf3f 100644 --- a/lib/galaxy/model/migrate/versions/0121_workflow_uuids.py +++ b/lib/galaxy/model/migrate/versions/0121_workflow_uuids.py @@ -33,7 +33,7 @@ def upgrade(migrate_engine): workflow_table = Table( "workflow", metadata, autoload=True ) workflow_uuid_column.create( workflow_table ) assert workflow_uuid_column is workflow_table.c.uuid - except Exception, e: + except Exception as e: print str(e) log.error( "Adding column 'uuid' to workflow table failed: %s" % str( e ) ) return @@ -48,5 +48,5 @@ def downgrade(migrate_engine): workflow_table = Table( "workflow", metadata, autoload=True ) workflow_uuid = workflow_table.c.uuid workflow_uuid.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping 'uuid' column from workflow table failed: %s" % ( str( e ) ) ) diff --git a/lib/galaxy/model/migrate/versions/0123_add_workflow_request_tables.py b/lib/galaxy/model/migrate/versions/0123_add_workflow_request_tables.py index 5dbc356387e..1236096dcb2 100644 --- a/lib/galaxy/model/migrate/versions/0123_add_workflow_request_tables.py +++ b/lib/galaxy/model/migrate/versions/0123_add_workflow_request_tables.py @@ -85,7 +85,7 @@ def upgrade(migrate_engine): cmd = "UPDATE workflow_invocation SET state = 'scheduled'" try: migrate_engine.execute( cmd ) - except Exception, e: + except Exception as e: log.debug( "failed to update past workflow invocation states: %s" % ( str( e ) ) ) WorkflowInvocationStepAction_column = Column( "action", JSONType, nullable=True ) diff --git a/lib/galaxy/openid/providers.py b/lib/galaxy/openid/providers.py index f1c498d3170..ac123003c14 100644 --- a/lib/galaxy/openid/providers.py +++ b/lib/galaxy/openid/providers.py @@ -107,7 +107,7 @@ class OpenIDProviders( object ): def from_file( cls, filename ): try: return cls.from_elem( parse_xml( filename ).getroot() ) - except Exception, e: + except Exception as e: log.error( 'Failed to load OpenID Providers: %s' % ( e ) ) return cls() @@ -120,7 +120,7 @@ class OpenIDProviders( object ): provider = OpenIDProvider.from_file( os.path.join( 'openid', elem.get( 'file' ) ) ) providers[ provider.id ] = provider log.debug( 'Loaded OpenID provider: %s (%s)' % ( provider.name, provider.id ) ) - except Exception, e: + except Exception as e: log.error( 'Failed to add OpenID provider: %s' % ( e ) ) return cls( providers ) diff --git a/lib/galaxy/security/__init__.py b/lib/galaxy/security/__init__.py index 3f2b6605c44..c5ab06c556f 100644 --- a/lib/galaxy/security/__init__.py +++ b/lib/galaxy/security/__init__.py @@ -496,7 +496,7 @@ class GalaxyRBACAgent( RBACAgent ): % ( item.library_dataset_id, len( base_result ), len( new_result ) ) ) log.debug( "get_actions_for_items: Test end" ) - except Exception, e: + except Exception as e: log.debug( "Exception in test code: %s" % e ) return ret_permissions diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index e6b1085e4b5..f2b999b8d48 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -109,7 +109,7 @@ class ToolBox( BaseGalaxyToolBox ): def create_tool( self, config_file, repository_id=None, guid=None, **kwds ): try: tool_source = get_tool_source( config_file, enable_beta_formats=getattr( self.app.config, "enable_beta_tool_formats", False ) ) - except Exception, e: + except Exception as e: # capture and log parsing errors global_tool_errors.add_error(config_file, "Tool XML parsing", e) raise e @@ -294,7 +294,7 @@ class Tool( object, Dictifiable ): # Parse XML element containing configuration try: self.parse( tool_source, guid=guid ) - except Exception, e: + except Exception as e: global_tool_errors.add_error(config_file, "Tool Loading", e) raise e self.history_manager = histories.HistoryManager( app ) @@ -942,7 +942,7 @@ class Tool( object, Dictifiable ): # Handle tool help image display for tools that are contained in repositories in the tool shed or installed into Galaxy. try: help_text = suc.set_image_paths( self.app, self.repository_id, help_text ) - except Exception, e: + except Exception as e: log.exception( "Exception in parse_help, so images may not be properly displayed:\n%s" % str( e ) ) try: self.__help = Template( rst_to_html(help_text), input_encoding='utf-8', @@ -1077,7 +1077,7 @@ class Tool( object, Dictifiable ): if 'rerun_remap_job_id' in incoming: try: rerun_remap_job_id = trans.app.security.decode_id( incoming[ 'rerun_remap_job_id' ] ) - except Exception, exception: + except Exception as exception: log.error( str( exception ) ) raise exceptions.MessageException( 'Failure executing tool (attempting to rerun invalid job).' ) @@ -1140,10 +1140,10 @@ class Tool( object, Dictifiable ): """ try: job, out_data = self.execute( trans, incoming=params, history=history, rerun_remap_job_id=rerun_remap_job_id, mapping_over_collection=mapping_over_collection, execution_cache=execution_cache ) - except httpexceptions.HTTPFound, e: + except httpexceptions.HTTPFound as e: # if it's a paste redirect exception, pass it up the stack raise e - except Exception, e: + except Exception as e: log.exception('Exception caught while attempting tool execution:') message = 'Error executing tool: %s' % str(e) return False, message @@ -1332,7 +1332,7 @@ class Tool( object, Dictifiable ): code = self.get_hook( hook_name ) if code: return code( *args, **kwargs ) - except Exception, e: + except Exception as e: original_message = '' if len( e.args ): original_message = e.args[0] @@ -1586,7 +1586,7 @@ class Tool( object, Dictifiable ): history = trans.get_history() if history is None: raise exceptions.MessageException( 'History unavailable. Please specify a valid history id' ) - except Exception, e: + except Exception as e: raise exceptions.MessageException( '[history_id=%s] Failed to retrieve history. %s.' % ( history_id, str( e ) ) ) # build request context @@ -1783,7 +1783,7 @@ class Tool( object, Dictifiable ): try: if [ hda.dependent_jobs for hda in [ jtod.dataset for jtod in job.output_datasets ] if hda.dependent_jobs ]: return True - except Exception, exception: + except Exception as exception: log.error( str( exception ) ) pass return False diff --git a/lib/galaxy/tools/actions/__init__.py b/lib/galaxy/tools/actions/__init__.py index 03b5d40ff38..4776bc47bf1 100644 --- a/lib/galaxy/tools/actions/__init__.py +++ b/lib/galaxy/tools/actions/__init__.py @@ -689,7 +689,7 @@ def filter_output(output, incoming): try: if not eval( filter.text.strip(), globals(), incoming ): return True # do not create this dataset - except Exception, e: + except Exception as e: log.debug( 'Dataset output filter failed: %s' % e ) return False @@ -729,7 +729,7 @@ def determine_output_format(output, parameter_context, input_datasets, input_dat input_dataset = input_collection.collection[element_index].element_object input_extension = input_dataset.ext ext = input_extension - except Exception, e: + except Exception as e: log.debug("Exception while trying to determine format_source: %s", e) pass diff --git a/lib/galaxy/tools/actions/upload_common.py b/lib/galaxy/tools/actions/upload_common.py index 8c7beb994b3..494602366b4 100644 --- a/lib/galaxy/tools/actions/upload_common.py +++ b/lib/galaxy/tools/actions/upload_common.py @@ -288,7 +288,7 @@ def create_paramfile( trans, uploaded_datasets ): p = subprocess.Popen( cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE ) stdout, stderr = p.communicate() assert p.returncode == 0, stderr - except Exception, e: + except Exception as e: log.warning( 'Changing ownership of uploaded file %s failed: %s' % ( path, str( e ) ) ) # TODO: json_file should go in the working directory diff --git a/lib/galaxy/tools/data/__init__.py b/lib/galaxy/tools/data/__init__.py index a2ea048235f..5d26f1c0c5f 100644 --- a/lib/galaxy/tools/data/__init__.py +++ b/lib/galaxy/tools/data/__init__.py @@ -117,7 +117,7 @@ class ToolDataTableManager( object ): table_elems = self.load_from_config_file( config_filename=config_filename, tool_data_path=tool_data_path, from_shed_config=True ) - except Exception, e: + except Exception as e: error_message = 'Error attempting to parse file %s: %s' % ( str( os.path.split( config_filename )[ 1 ] ), str( e ) ) log.debug( error_message ) table_elems = [] @@ -144,7 +144,7 @@ class ToolDataTableManager( object ): tree = util.parse_xml( full_path ) root = tree.getroot() out_elems = [ elem for elem in root ] - except Exception, e: + except Exception as e: out_elems = [] log.debug( 'Could not parse existing tool data table config, assume no existing elements: %s', e ) for elem in remove_elems: @@ -291,7 +291,7 @@ class TabularToolDataTable( ToolDataTable, Dictifiable ): tmp_file = NamedTemporaryFile( prefix='TTDT_URL_%s-' % self.name ) try: tmp_file.write( urlopen( filename, timeout=url_timeout ).read() ) - except Exception, e: + except Exception as e: log.error( 'Error loading Data Table URL "%s": %s', filename, e ) continue log.debug( 'Loading Data Table URL "%s" as filename "%s".', filename, tmp_file.name ) @@ -569,7 +569,7 @@ class TabularToolDataTable( ToolDataTable, Dictifiable ): log.debug( "Persisting changes to file: %s", filename ) try: data_table_fh = open( filename, 'r+b' ) - except IOError, e: + except IOError as e: log.warning( 'Error opening data table file (%s) with r+b, assuming file does not exist and will open as wb: %s', filename, e ) data_table_fh = open( filename, 'wb' ) if os.stat( filename )[6] != 0: diff --git a/lib/galaxy/tools/data_manager/manager.py b/lib/galaxy/tools/data_manager/manager.py index 9b4570e1473..b9035cd8947 100644 --- a/lib/galaxy/tools/data_manager/manager.py +++ b/lib/galaxy/tools/data_manager/manager.py @@ -37,7 +37,7 @@ class DataManagers( object ): def load_from_xml( self, xml_filename, store_tool_path=True, replace_existing=False ): try: tree = util.parse_xml( xml_filename ) - except Exception, e: + except Exception as e: log.error( 'There was an error parsing your Data Manager config file "%s": %s' % ( xml_filename, e ) ) return # we are not able to load any data managers root = tree.getroot() @@ -57,7 +57,7 @@ class DataManagers( object ): def load_manager_from_elem( self, data_manager_elem, tool_path=None, add_manager=True, replace_existing=False ): try: data_manager = DataManager( self, data_manager_elem, tool_path=tool_path ) - except Exception, e: + except Exception as e: log.error( "Error loading data_manager '%s':\n%s" % ( e, util.xml_to_string( data_manager_elem ) ) ) return None if add_manager: @@ -161,7 +161,7 @@ class DataManager( object ): tool_shed_repository_id = None try: tool_path = util.parse_xml( elem.get( 'shed_conf_file' ) ).getroot().get( 'tool_path', tool_path ) - except Exception, e: + except Exception as e: log.error( 'Error determining tool_path for Data Manager during testing: %s', e ) else: tool_shed_repository_id = self.data_managers.app.security.encode_id( tool_shed_repository.id ) @@ -264,7 +264,7 @@ class DataManager( object ): for output_name, output_dataset in out_data.iteritems(): try: output_dict = json.loads( open( output_dataset.file_name ).read() ) - except Exception, e: + except Exception as e: log.warning( 'Error reading DataManagerTool json for "%s": %s' % ( output_name, e ) ) continue data_manager_dicts[ output_name ] = output_dict @@ -354,7 +354,7 @@ class DataManager( object ): dirs = os.path.split( target )[0] try: os.makedirs( dirs ) - except OSError, e: + except OSError as e: if e.errno != errno.EEXIST: raise e # moving a directory and the target already exists, we move the contents instead diff --git a/lib/galaxy/tools/evaluation.py b/lib/galaxy/tools/evaluation.py index f7adb8317e0..dfa6c70e545 100644 --- a/lib/galaxy/tools/evaluation.py +++ b/lib/galaxy/tools/evaluation.py @@ -427,25 +427,25 @@ class ToolEvaluator( object ): try: self.__build_config_files( ) - except Exception, e: + except Exception as e: # capture and log parsing errors global_tool_errors.add_error(self.tool.config_file, "Building Config Files", e) raise e try: self.__build_param_file( ) - except Exception, e: + except Exception as e: # capture and log parsing errors global_tool_errors.add_error(self.tool.config_file, "Building Param File", e) raise e try: self.__build_command_line( ) - except Exception, e: + except Exception as e: # capture and log parsing errors global_tool_errors.add_error(self.tool.config_file, "Building Command Line", e) raise e try: self.__build_environment_variables() - except Exception, e: + except Exception as e: global_tool_errors.add_error(self.tool.config_file, "Building Environment Variables", e) raise e diff --git a/lib/galaxy/tools/imp_exp/__init__.py b/lib/galaxy/tools/imp_exp/__init__.py index 855ae24fae2..248da34f54c 100644 --- a/lib/galaxy/tools/imp_exp/__init__.py +++ b/lib/galaxy/tools/imp_exp/__init__.py @@ -291,7 +291,7 @@ class JobImportHistoryArchiveWrapper( object, UsesAnnotations ): # Cleanup. if os.path.exists( archive_dir ): shutil.rmtree( archive_dir ) - except Exception, e: + except Exception as e: jiha.job.stderr += "Error cleaning up history import job: %s" % e self.sa_session.flush() raise @@ -525,10 +525,10 @@ class JobExportHistoryArchiveWrapper( object, UsesAnnotations ): for filename in [ jeha.history_attrs_filename, jeha.datasets_attrs_filename, jeha.jobs_attrs_filename ]: try: os.remove( filename ) - except Exception, e: + except Exception as e: log.debug( 'Failed to cleanup attributes file (%s): %s' % ( filename, e ) ) temp_dir = os.path.split( jeha.history_attrs_filename )[0] try: shutil.rmtree( temp_dir ) - except Exception, e: + except Exception as e: log.debug( 'Error deleting directory containing attribute files (%s): %s' % ( temp_dir, e ) ) diff --git a/lib/galaxy/tools/imp_exp/export_history.py b/lib/galaxy/tools/imp_exp/export_history.py index 36be42e560e..f035f6e610e 100644 --- a/lib/galaxy/tools/imp_exp/export_history.py +++ b/lib/galaxy/tools/imp_exp/export_history.py @@ -90,7 +90,7 @@ def create_archive( history_attrs_file, datasets_attrs_file, jobs_attrs_file, ou # Status. return 'Created history archive.' - except Exception, e: + except Exception as e: return 'Error creating history archive: %s' % str( e ), sys.stderr diff --git a/lib/galaxy/tools/imp_exp/unpack_tar_gz_archive.py b/lib/galaxy/tools/imp_exp/unpack_tar_gz_archive.py index f3dab0c5ae4..932779c0e43 100644 --- a/lib/galaxy/tools/imp_exp/unpack_tar_gz_archive.py +++ b/lib/galaxy/tools/imp_exp/unpack_tar_gz_archive.py @@ -39,7 +39,7 @@ def url_to_file( url, dest_file ): break fp.close() return dest_file - except Exception, e: + except Exception as e: print "Exception getting file from URL: %s" % e, sys.stderr return None @@ -98,5 +98,5 @@ if __name__ == "__main__": (options, args) = parser.parse_args() try: main(options, args) - except Exception, e: + except Exception as e: print "Error unpacking tar/gz archive: %s" % e, sys.stderr diff --git a/lib/galaxy/tools/parameters/__init__.py b/lib/galaxy/tools/parameters/__init__.py index 54d6ee858a6..cbb58e107f0 100644 --- a/lib/galaxy/tools/parameters/__init__.py +++ b/lib/galaxy/tools/parameters/__init__.py @@ -129,7 +129,7 @@ def check_param( trans, param, incoming_value, param_values ): return [ value, None ] value = param.from_json( value, trans, param_values ) param.validate( value, trans ) - except ValueError, e: + except ValueError as e: error = str( e ) return value, error diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index 9ab8a1d2ac6..6d6038f8191 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -343,7 +343,7 @@ class IntegerToolParameter( TextToolParameter ): def to_python( self, value, app ): try: return int( value ) - except Exception, err: + except Exception as err: if contains_workflow_parameter(value): return value if not value and self.optional: @@ -423,7 +423,7 @@ class FloatToolParameter( TextToolParameter ): def to_python( self, value, app ): try: return float( value ) - except Exception, err: + except Exception as err: if contains_workflow_parameter(value): return value if not value and self.optional: @@ -850,7 +850,7 @@ class SelectToolParameter( ToolParameter ): call_other_values = self._get_dynamic_options_call_other_values( trans, other_values ) try: return eval( self.dynamic_options, self.tool.code_namespace, call_other_values ) - except Exception, e: + except Exception as e: log.debug( "Error determining dynamic options for parameter '%s' in tool '%s':", self.name, self.tool.id, exc_info=e ) return [] else: @@ -863,7 +863,7 @@ class SelectToolParameter( ToolParameter ): try: call_other_values = self._get_dynamic_options_call_other_values( trans, other_values ) return set( v for _, v, _ in eval( self.dynamic_options, self.tool.code_namespace, call_other_values ) ) - except Exception, e: + except Exception as e: log.debug( 'Determining legal values failed for "%s": %s', self.name, e ) return set() else: diff --git a/lib/galaxy/tools/parameters/grouping.py b/lib/galaxy/tools/parameters/grouping.py index 653decf7fe6..290534977f0 100644 --- a/lib/galaxy/tools/parameters/grouping.py +++ b/lib/galaxy/tools/parameters/grouping.py @@ -106,7 +106,7 @@ class Repeat( Group ): else: rval_dict[ input.name ] = input.value_from_basic( d[input.name], app, ignore_errors ) rval.append( rval_dict ) - except Exception, e: + except Exception as e: if not ignore_errors: raise e return rval @@ -161,7 +161,7 @@ class Section( Group ): for input in self.inputs.itervalues(): if not ignore_errors or input.name in value: rval[ input.name ] = input.value_from_basic( value[ input.name ], app, ignore_errors ) - except Exception, e: + except Exception as e: if not ignore_errors: raise e return rval @@ -564,7 +564,7 @@ class Conditional( Group ): # conditional's values dictionary. if not ignore_errors or input.name in value: rval[ input.name ] = input.value_from_basic( value[ input.name ], app, ignore_errors ) - except Exception, e: + except Exception as e: if not ignore_errors: raise e return rval diff --git a/lib/galaxy/tools/parameters/sanitize.py b/lib/galaxy/tools/parameters/sanitize.py index ac22df8ac9d..a976d32c71f 100644 --- a/lib/galaxy/tools/parameters/sanitize.py +++ b/lib/galaxy/tools/parameters/sanitize.py @@ -100,7 +100,7 @@ class ToolParameterSanitizer( object ): if split_name.startswith( 'string.' ): try: value = eval( split_name ) - except NameError, e: + except NameError as e: log.debug( 'Invalid string preset specified: %s' % e ) elif split_name in cls.VALID_PRESET: value = cls.VALID_PRESET[ split_name ] diff --git a/lib/galaxy/tools/test.py b/lib/galaxy/tools/test.py index 916cab780b0..fb31a0294a3 100644 --- a/lib/galaxy/tools/test.py +++ b/lib/galaxy/tools/test.py @@ -145,7 +145,7 @@ class ToolTestBuilder( object ): self.expect_exit_code = test_dict.get("expect_exit_code", None) self.expect_failure = test_dict.get("expect_failure", False) self.md5 = test_dict.get("md5", None) - except Exception, e: + except Exception as e: self.inputs = {} self.error = True self.exception = e diff --git a/lib/galaxy/tools/util/maf_utilities.py b/lib/galaxy/tools/util/maf_utilities.py index 008c5d9d0c8..d2e92b061d7 100644 --- a/lib/galaxy/tools/util/maf_utilities.py +++ b/lib/galaxy/tools/util/maf_utilities.py @@ -89,7 +89,7 @@ class TempFileHandler( object ): tmp_file = tempfile.NamedTemporaryFile( **temp_kwds ) filename = tmp_file.name break - except OSError, e: + except OSError as e: if self.open_file_indexes and e.errno == EMFILE: self.max_open_files = len( self.open_file_indexes ) self.close( self.open_file_indexes[0] ) @@ -102,7 +102,7 @@ class TempFileHandler( object ): try: self.files[ index ] = open( self.files[ index ].name, 'r+b' ) break - except OSError, e: + except OSError as e: if self.open_file_indexes and e.errno == EMFILE: self.max_open_files = len( self.open_file_indexes ) self.close( self.open_file_indexes[0] ) @@ -290,7 +290,7 @@ def maf_index_by_uid( maf_uid, index_location_file ): try: maf_files = fields[4].replace( "\n", "" ).replace( "\r", "" ).split( "," ) return bx.align.maf.MultiIndexed( maf_files, keep_open=True, parse_e_rows=False ) - except Exception, e: + except Exception as e: raise Exception( 'MAF UID (%s) found, but configuration appears to be malformed: %s' % ( maf_uid, e ) ) except: pass @@ -341,7 +341,7 @@ def build_maf_index_species_chromosomes( filename, index_species=None ): if forward_strand_end > forward_strand_start: # require positive length; i.e. certain lines have start = end = 0 and cannot be indexed indexes.add( c.src, forward_strand_start, forward_strand_end, pos, max=c.src_size ) - except Exception, e: + except Exception as e: # most likely a bad MAF log.debug( 'Building MAF index on %s failed: %s' % ( filename, e ) ) return ( None, [], {}, 0 ) diff --git a/lib/galaxy/visualization/genomes.py b/lib/galaxy/visualization/genomes.py index 8cf82de7f43..6a43139b34f 100644 --- a/lib/galaxy/visualization/genomes.py +++ b/lib/galaxy/visualization/genomes.py @@ -214,7 +214,7 @@ class Genomes( object ): if len( val ) == 2: key, path = val twobit_fields[ key ] = path - except IOError, e: + except IOError as e: # Thrown if twobit.loc does not exist. log.exception( "Error reading twobit.loc: %s", e ) for key, description in self.app.genome_builds.get_genome_build_names(): diff --git a/lib/galaxy/visualization/plugins/resource_parser.py b/lib/galaxy/visualization/plugins/resource_parser.py index 89f0c6e11e4..d98e6842167 100644 --- a/lib/galaxy/visualization/plugins/resource_parser.py +++ b/lib/galaxy/visualization/plugins/resource_parser.py @@ -74,7 +74,7 @@ class ResourceParser( object ): resource = self.parse_parameter( trans, param_config, query_val, param_modifiers=target_param_modifiers ) - except Exception, exception: + except Exception as exception: if trans.debug: raise else: @@ -108,7 +108,7 @@ class ResourceParser( object ): try: config_val = self.parse_parameter( trans, param_config, config_val ) - except Exception, exception: + except Exception as exception: log.warn( 'Exception parsing visualization param from query: ' + '%s, %s, (%s) %s' % ( param_name, config_val, str( type( exception ) ), str( exception ) )) config_val = None diff --git a/lib/galaxy/web/base/controller.py b/lib/galaxy/web/base/controller.py index e7ed71596d2..5fdd54fef4e 100644 --- a/lib/galaxy/web/base/controller.py +++ b/lib/galaxy/web/base/controller.py @@ -181,7 +181,7 @@ class BaseAPIController( BaseController ): raise HTTPBadRequest( detail="Invalid %s id ( %s ) specified: %s" % ( class_name, str( id ), str( e ) ) ) except MessageException as e: raise HTTPBadRequest( detail=e.err_msg ) - except Exception, e: + except Exception as e: log.exception( "Exception in get_object check for %s %s." % ( class_name, str( id ) ) ) raise HTTPInternalServerError( comment=str( e ) ) @@ -271,7 +271,7 @@ class JSAppLauncher( BaseUIController ): if self.user_manager.is_admin( trans.user ): serializer = self.admin_config_serializer return serializer.serialize_to_view( self.app.config, view='all' ) - except Exception, exc: + except Exception as exc: log.exception( exc ) return {} diff --git a/lib/galaxy/web/framework/base.py b/lib/galaxy/web/framework/base.py index 5bdd037cfdd..844c565a5ac 100644 --- a/lib/galaxy/web/framework/base.py +++ b/lib/galaxy/web/framework/base.py @@ -192,7 +192,7 @@ class WebApplication( object ): kwargs.pop( '_', None ) try: body = method( trans, **kwargs ) - except Exception, e: + except Exception as e: body = self.handle_controller_exception( e, trans, **kwargs ) if not body: raise diff --git a/lib/galaxy/web/framework/webapp.py b/lib/galaxy/web/framework/webapp.py index fb2e31e1737..473d4c269d5 100644 --- a/lib/galaxy/web/framework/webapp.py +++ b/lib/galaxy/web/framework/webapp.py @@ -113,7 +113,7 @@ class WebApplication( base.WebApplication ): module_name = package_name + "." + name try: module = import_module( module_name ) - except ControllerUnavailable, exc: + except ControllerUnavailable as exc: log.debug("%s could not be loaded: %s" % (module_name, str(exc))) continue # Look for a controller inside the modules @@ -138,7 +138,7 @@ class WebApplication( base.WebApplication ): module_name = package_name + "." + name try: module = import_module( module_name ) - except ControllerUnavailable, exc: + except ControllerUnavailable as exc: log.debug("%s could not be loaded: %s" % (module_name, str(exc))) continue for key in dir( module ): @@ -252,7 +252,7 @@ class GalaxyWebTransaction( base.DefaultWebTransaction, for locale in client_locales: try: locales.append( Locale.parse( locale.split( ';' )[0].strip(), sep='-' ).language ) - except Exception, e: + except Exception as e: log.debug( "Error parsing locale '%s'. %s: %s", locale, type( e ), e ) if not locales: # Default to English @@ -347,7 +347,7 @@ class GalaxyWebTransaction( base.DefaultWebTransaction, self.response.cookies[name]['secure'] = True try: self.response.cookies[name]['httponly'] = True - except CookieError, e: + except CookieError as e: log.warning( "Error setting httponly attribute in cookie '%s': %s" % ( name, e ) ) def _authenticate_api( self, session_cookie ): diff --git a/lib/galaxy/web/proxy/__init__.py b/lib/galaxy/web/proxy/__init__.py index b35a1b09860..d46f68c6968 100644 --- a/lib/galaxy/web/proxy/__init__.py +++ b/lib/galaxy/web/proxy/__init__.py @@ -22,14 +22,14 @@ class ProxyManager(object): def __init__( self, config ): for option in ["manage_dynamic_proxy", "dynamic_proxy_bind_port", - "dynamic_proxy_bind_ip", "dynamic_proxy_debug", - "dynamic_proxy_external_proxy", "dynamic_proxy_prefix", - "proxy_session_map", - "dynamic_proxy", "cookie_path", - "dynamic_proxy_golang_noaccess", - "dynamic_proxy_golang_clean_interval", - "dynamic_proxy_golang_docker_address", - "dynamic_proxy_golang_api_key"]: + "dynamic_proxy_bind_ip", "dynamic_proxy_debug", + "dynamic_proxy_external_proxy", "dynamic_proxy_prefix", + "proxy_session_map", + "dynamic_proxy", "cookie_path", + "dynamic_proxy_golang_noaccess", + "dynamic_proxy_golang_clean_interval", + "dynamic_proxy_golang_docker_address", + "dynamic_proxy_golang_api_key"]: setattr( self, option, getattr( config, option ) ) @@ -250,7 +250,7 @@ class RestGolangProxyIpc(object): # going, so if this fails, re-call ourselves with an increased timeout. try: urllib2.urlopen(req, json.dumps(values)) - except urllib2.URLError, err: + except urllib2.URLError as err: log.debug(err) if sleep > 5: excp = "Could not contact proxy after %s seconds" % sum(range(sleep + 1)) diff --git a/lib/galaxy/webapps/galaxy/api/folder_contents.py b/lib/galaxy/webapps/galaxy/api/folder_contents.py index 0db5c7ec57b..5a1d14fab4e 100644 --- a/lib/galaxy/webapps/galaxy/api/folder_contents.py +++ b/lib/galaxy/webapps/galaxy/api/folder_contents.py @@ -290,7 +290,7 @@ class FolderContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrary raise exceptions.ObjectAttributeInvalidException( 'You cannot add datasets into deleted library. Undelete it first.' ) except exceptions.InsufficientPermissionsException: raise exceptions.exceptions.InsufficientPermissionsException( 'You do not have proper permissions to add a dataset to a folder with id (%s)' % ( encoded_folder_id ) ) - except Exception, exc: + except Exception as exc: # TODO handle exceptions better within the mixins if ( ( 'not accessible to the current user' in str( exc ) ) or ( 'You are not allowed to access this dataset' in str( exc ) ) ): raise exceptions.ItemAccessibilityException( 'You do not have access to the requested item' ) diff --git a/lib/galaxy/webapps/galaxy/api/group_roles.py b/lib/galaxy/webapps/galaxy/api/group_roles.py index b4d40b4d0f3..f9ac634a1be 100644 --- a/lib/galaxy/webapps/galaxy/api/group_roles.py +++ b/lib/galaxy/webapps/galaxy/api/group_roles.py @@ -33,7 +33,7 @@ class GroupRolesAPIController( BaseAPIController ): rval.append( dict( id=encoded_id, name=role.name, url=url_for( 'group_role', group_id=group_id, id=encoded_id, ) ) ) - except Exception, e: + except Exception as e: rval = "Error in group API at listing roles" log.error( rval + ": %s" % str(e) ) trans.response.status = 500 @@ -60,7 +60,7 @@ class GroupRolesAPIController( BaseAPIController ): url=url_for( 'group_role', group_id=group_id, id=role_id) ) # TODO Fix This if not item: item = "role %s not in group %s" % (role.name, group.name) - except Exception, e: + except Exception as e: item = "Error in group_role API group %s role %s" % (group.name, role.name) log.error(item + ": %s" % str(e)) return item @@ -92,7 +92,7 @@ class GroupRolesAPIController( BaseAPIController ): item = dict( id=role_id, name=role.name, url=url_for( 'group_role', group_id=group_id, id=role_id) ) - except Exception, e: + except Exception as e: item = "Error in group_role API Adding role %s to group %s" % (role.name, group.name) log.error(item + ": %s" % str(e)) return item @@ -119,7 +119,7 @@ class GroupRolesAPIController( BaseAPIController ): url=url_for( 'group_role', group_id=group_id, id=role_id) ) if not item: item = "role %s not in group %s" % (role.name, group.name) - except Exception, e: + except Exception as e: item = "Error in group_role API Removing role %s from group %s" % (role.name, group.name) log.error(item + ": %s" % str(e)) return item diff --git a/lib/galaxy/webapps/galaxy/api/group_users.py b/lib/galaxy/webapps/galaxy/api/group_users.py index 51dae1f3265..64a107dba70 100644 --- a/lib/galaxy/webapps/galaxy/api/group_users.py +++ b/lib/galaxy/webapps/galaxy/api/group_users.py @@ -33,7 +33,7 @@ class GroupUsersAPIController( BaseAPIController ): rval.append( dict( id=encoded_id, email=user.email, url=url_for( 'group_user', group_id=group_id, id=encoded_id, ) ) ) - except Exception, e: + except Exception as e: rval = "Error in group API at listing users" log.error( rval + ": %s" % str(e) ) trans.response.status = 500 @@ -60,7 +60,7 @@ class GroupUsersAPIController( BaseAPIController ): url=url_for( 'group_user', group_id=group_id, id=user_id) ) # TODO Fix This if not item: item = "user %s not in group %s" % (user.email, group.name) - except Exception, e: + except Exception as e: item = "Error in group_user API group %s user %s" % (group.name, user.email) log.error(item + ": %s" % str(e)) return item @@ -92,7 +92,7 @@ class GroupUsersAPIController( BaseAPIController ): item = dict( id=user_id, email=user.email, url=url_for( 'group_user', group_id=group_id, id=user_id) ) - except Exception, e: + except Exception as e: item = "Error in group_user API Adding user %s to group %s" % (user.email, group.name) log.error(item + ": %s" % str(e)) return item @@ -119,7 +119,7 @@ class GroupUsersAPIController( BaseAPIController ): url=url_for( 'group_user', group_id=group_id, id=user_id) ) if not item: item = "user %s not in group %s" % (user.email, group.name) - except Exception, e: + except Exception as e: item = "Error in group_user API Removing user %s from group %s" % (user.email, group.name) log.error(item + ": %s" % str(e)) return item diff --git a/lib/galaxy/webapps/galaxy/api/history_contents.py b/lib/galaxy/webapps/galaxy/api/history_contents.py index cee8663c5c5..b11655eabd5 100644 --- a/lib/galaxy/webapps/galaxy/api/history_contents.py +++ b/lib/galaxy/webapps/galaxy/api/history_contents.py @@ -156,7 +156,7 @@ class HistoryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar id=id, ) return self.__collection_dict( trans, dataset_collection_instance, view="element" ) - except Exception, e: + except Exception as e: log.exception( "Error in history API at listing dataset collection: %s", e ) trans.response.status = 500 return { 'error': str( e ) } diff --git a/lib/galaxy/webapps/galaxy/api/library_contents.py b/lib/galaxy/webapps/galaxy/api/library_contents.py index 9daf51968a2..bc58d2e7cf0 100644 --- a/lib/galaxy/webapps/galaxy/api/library_contents.py +++ b/lib/galaxy/webapps/galaxy/api/library_contents.py @@ -81,7 +81,7 @@ class LibraryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar raise exceptions.InconsistentDatabase( 'Multiple libraries found with the same id.' ) except NoResultFound: raise exceptions.RequestParameterInvalidException( 'No library found with the id provided.' ) - except Exception, e: + except Exception as e: raise exceptions.InternalServerError( 'Error loading from the database.' + str(e)) if not ( trans.user_is_admin() or trans.app.security_agent.can_access_library( current_user_roles, library ) ): raise exceptions.RequestParameterInvalidException( 'No library found with the id provided.' ) @@ -202,7 +202,7 @@ class LibraryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar try: # security is checked in the downstream controller parent = self.get_library_folder( trans, folder_id, check_ownership=False, check_accessible=False ) - except Exception, e: + except Exception as e: return str( e ) # The rest of the security happens in the library_common controller. real_folder_id = trans.security.encode_id( parent.id ) @@ -319,7 +319,7 @@ class LibraryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar ldda_dict = ldda.to_dict() rval = trans.security.encode_dict_ids( ldda_dict ) - except Exception, exc: + except Exception as exc: # TODO: grrr... if 'not accessible to the current user' in str( exc ): trans.response.status = 403 @@ -430,13 +430,13 @@ class LibraryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar trans.sa_session.flush() rval[ 'deleted' ] = True - except exceptions.httpexceptions.HTTPInternalServerError, http_server_err: + except exceptions.httpexceptions.HTTPInternalServerError as http_server_err: log.exception( 'Library_contents API, delete: uncaught HTTPInternalServerError: %s, %s\n%s', id, str( kwd ), str( http_server_err ) ) raise except exceptions.httpexceptions.HTTPException: raise - except Exception, exc: + except Exception as exc: log.exception( 'library_contents API, delete: uncaught exception: %s, %s\n%s', id, str( kwd ), str( exc ) ) trans.response.status = 500 diff --git a/lib/galaxy/webapps/galaxy/api/quotas.py b/lib/galaxy/webapps/galaxy/api/quotas.py index 1403f09ab47..2cca27db956 100644 --- a/lib/galaxy/webapps/galaxy/api/quotas.py +++ b/lib/galaxy/webapps/galaxy/api/quotas.py @@ -61,12 +61,12 @@ class QuotaAPIController( BaseAPIController, Admin, AdminActions, UsesQuotaMixin """ try: self.validate_in_users_and_groups( trans, payload ) - except Exception, e: + except Exception as e: raise HTTPBadRequest( detail=str( e ) ) params = self.get_quota_params( payload ) try: quota, message = self._create_quota( params ) - except ActionInputError, e: + except ActionInputError as e: raise HTTPBadRequest( detail=str( e ) ) item = quota.to_dict( value_mapper={ 'id': trans.security.encode_id } ) item['url'] = url_for( 'quota', id=trans.security.encode_id( quota.id ) ) @@ -82,7 +82,7 @@ class QuotaAPIController( BaseAPIController, Admin, AdminActions, UsesQuotaMixin """ try: self.validate_in_users_and_groups( trans, payload ) - except Exception, e: + except Exception as e: raise HTTPBadRequest( detail=str( e ) ) quota = self.get_quota( trans, id, deleted=False ) @@ -106,7 +106,7 @@ class QuotaAPIController( BaseAPIController, Admin, AdminActions, UsesQuotaMixin for method in methods: try: message = method( quota, params ) - except ActionInputError, e: + except ActionInputError as e: raise HTTPBadRequest( detail=str( e ) ) messages.append( message ) return '; '.join( messages ) @@ -129,7 +129,7 @@ class QuotaAPIController( BaseAPIController, Admin, AdminActions, UsesQuotaMixin message = self._mark_quota_deleted( quota, params ) if util.string_as_bool( payload.get( 'purge', False ) ): message += self._purge_quota( quota, params ) - except ActionInputError, e: + except ActionInputError as e: raise HTTPBadRequest( detail=str( e ) ) return message @@ -143,5 +143,5 @@ class QuotaAPIController( BaseAPIController, Admin, AdminActions, UsesQuotaMixin quota = self.get_quota( trans, id, deleted=True ) try: return self._undelete_quota( quota ) - except ActionInputError, e: + except ActionInputError as e: raise HTTPBadRequest( detail=str( e ) ) diff --git a/lib/galaxy/webapps/galaxy/api/remote_files.py b/lib/galaxy/webapps/galaxy/api/remote_files.py index c0c6be8d78d..28d42cd45c0 100644 --- a/lib/galaxy/webapps/galaxy/api/remote_files.py +++ b/lib/galaxy/webapps/galaxy/api/remote_files.py @@ -50,7 +50,7 @@ class RemoteFilesAPIController( BaseAPIController ): try: userdir_jstree = self.__create_jstree( full_import_dir, disable ) response = userdir_jstree.jsonData() - except Exception, exception: + except Exception as exception: log.debug( str( exception ) ) raise exceptions.InternalServerError( 'Could not create tree representation of the given folder: ' + str( full_import_dir ) ) if not response: @@ -60,7 +60,7 @@ class RemoteFilesAPIController( BaseAPIController ): else: try: response = self.__load_all_filenames( full_import_dir ) - except Exception, exception: + except Exception as exception: log.error( 'Could not get user import files: %s', str( exception ), exc_info=True ) raise exceptions.InternalServerError( 'Could not get the files from your user directory folder.' ) else: @@ -74,7 +74,7 @@ class RemoteFilesAPIController( BaseAPIController ): try: importdir_jstree = self.__create_jstree( base_dir, disable ) response = importdir_jstree.jsonData() - except Exception, exception: + except Exception as exception: log.debug( str( exception ) ) raise exceptions.InternalServerError( 'Could not create tree representation of the given folder: ' + str( base_dir ) ) elif format == 'ajax': @@ -82,7 +82,7 @@ class RemoteFilesAPIController( BaseAPIController ): else: try: response = self.__load_all_filenames( base_dir ) - except Exception, exception: + except Exception as exception: log.error( 'Could not get user import files: %s', str( exception ), exc_info=True ) raise exceptions.InternalServerError( 'Could not get the files from your import directory folder.' ) else: @@ -96,7 +96,7 @@ class RemoteFilesAPIController( BaseAPIController ): else: log.warning( 'You do not have an FTP directory named as your login at this Galaxy instance.' ) return None - except Exception, exception: + except Exception as exception: log.warning( 'Could not get ftp files: %s', str( exception ), exc_info=True ) return None return response diff --git a/lib/galaxy/webapps/galaxy/api/search.py b/lib/galaxy/webapps/galaxy/api/search.py index 444a620aad6..c037562451e 100644 --- a/lib/galaxy/webapps/galaxy/api/search.py +++ b/lib/galaxy/webapps/galaxy/api/search.py @@ -24,14 +24,14 @@ class SearchController( BaseAPIController, SharableItemSecurityMixin ): se = GalaxySearchEngine() try: query = se.query(query_txt) - except Exception, e: + except Exception as e: return {'error': str(e)} if query is not None: query.decode_query_ids(trans) current_user_roles = trans.get_current_user_roles() try: results = query.process(trans) - except Exception, e: + except Exception as e: return {'error': str(e)} for item in results: append = False diff --git a/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py b/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py index aaf11b14cc7..fdf890deb50 100644 --- a/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py +++ b/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py @@ -117,7 +117,7 @@ class ToolShedRepositoriesController( BaseAPIController ): pathspec = [ 'api', 'repositories', 'get_ordered_installable_revisions' ] try: raw_text = util.url_get( tool_shed_url, password_mgr=self.app.tool_shed_registry.url_auth( tool_shed_url ), pathspec=pathspec, params=params ) - except Exception, e: + except Exception as e: message = "Error attempting to retrieve the latest installable revision from tool shed %s for repository %s owned by %s: %s" % \ ( str( tool_shed_url ), str( name ), str( owner ), str( e ) ) log.debug( message ) @@ -517,7 +517,7 @@ class ToolShedRepositoriesController( BaseAPIController ): message = "Successfully reset metadata on repository %s owned by %s" % \ ( str( repository.name ), str( repository.owner ) ) results[ 'successful_count' ] += 1 - except Exception, e: + except Exception as e: message = "Error resetting metadata on repository %s owned by %s: %s" % \ ( str( repository.name ), str( repository.owner ), str( e ) ) results[ 'unsuccessful_count' ] += 1 diff --git a/lib/galaxy/webapps/galaxy/api/visualizations.py b/lib/galaxy/webapps/galaxy/api/visualizations.py index 7f40a214d1f..2b24a0c8114 100644 --- a/lib/galaxy/webapps/galaxy/api/visualizations.py +++ b/lib/galaxy/webapps/galaxy/api/visualizations.py @@ -104,7 +104,7 @@ class VisualizationsController( BaseAPIController, UsesVisualizationMixin, Shara try: # generate defaults - this will err if given a weird key? visualization = self.create_visualization( trans, vis_type, **payload ) - except ValueError, val_err: + except ValueError as val_err: raise exceptions.RequestParameterMissingException( str( val_err ) ) rval = { 'id' : trans.security.encode_id( visualization.id ) } diff --git a/lib/galaxy/webapps/galaxy/api/workflows.py b/lib/galaxy/webapps/galaxy/api/workflows.py index 8e48764e74e..f88b8ca91b1 100644 --- a/lib/galaxy/webapps/galaxy/api/workflows.py +++ b/lib/galaxy/webapps/galaxy/api/workflows.py @@ -251,7 +251,7 @@ class WorkflowsAPIController(BaseAPIController, UsesStoredWorkflowMixin, UsesAnn try: stored_workflow = trans.sa_session.query(self.app.model.StoredWorkflow).get(self.decode_id(workflow_id)) - except Exception, e: + except Exception as e: trans.response.status = 400 return ("Workflow with ID='%s' can not be found\n Exception: %s") % (workflow_id, str( e )) diff --git a/lib/galaxy/webapps/galaxy/controllers/admin.py b/lib/galaxy/webapps/galaxy/controllers/admin.py index d3c1414c549..7757e5aada0 100644 --- a/lib/galaxy/webapps/galaxy/controllers/admin.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin.py @@ -539,7 +539,7 @@ class AdminGalaxy( BaseUIController, Admin, AdminActions, UsesQuotaMixin, QuotaP webapp=params.webapp, message=sanitize_text( message ), status='done' ) ) - except MessageException, e: + except MessageException as e: params.message = str( e ) params.status = 'error' in_users = map( int, params.in_users ) @@ -712,7 +712,7 @@ class AdminGalaxy( BaseUIController, Admin, AdminActions, UsesQuotaMixin, QuotaP for id in galaxy.util.listify( params.id ): try: quota.append( self.get_quota( trans, id ) ) - except MessageException, e: + except MessageException as e: messages.append( str( e ) ) if messages: return None, trans.response.send_redirect( web.url_for( controller='admin', @@ -723,7 +723,7 @@ class AdminGalaxy( BaseUIController, Admin, AdminActions, UsesQuotaMixin, QuotaP else: try: quota = self.get_quota( trans, params.id, deleted=False ) - except MessageException, e: + except MessageException as e: return None, trans.response.send_redirect( web.url_for( controller='admin', action='quotas', webapp=params.webapp, @@ -737,7 +737,7 @@ class AdminGalaxy( BaseUIController, Admin, AdminActions, UsesQuotaMixin, QuotaP webapp=params.webapp, message=sanitize_text( message ), status='done' ) ) - except MessageException, e: + except MessageException as e: params.message = e.err_msg params.status = e.type return quota, params diff --git a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py index 9756a7d63a1..7b3b4ceb0ab 100644 --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -49,7 +49,7 @@ class AdminToolshed( AdminGalaxy ): repository = repository_util.get_installed_tool_shed_repository( trans.app, repository_id ) try: trans.app.installed_repository_manager.activate_repository( repository ) - except Exception, e: + except Exception as e: error_message = "Error activating repository %s: %s" % ( escape( repository.name ), str( e ) ) log.exception( error_message ) message = '%s.
You may be able to resolve this by uninstalling and then reinstalling the repository. Click here to uninstall the repository.' \ @@ -326,7 +326,7 @@ class AdminToolshed( AdminGalaxy ): shutil.rmtree( repository_install_dir ) log.debug( "Removed repository installation directory: %s" % str( repository_install_dir ) ) removed = True - except Exception, e: + except Exception as e: log.debug( "Error removing repository installation directory %s: %s" % ( str( repository_install_dir ), str( e ) ) ) if isinstance( e, OSError ) and not os.path.exists( repository_install_dir ): removed = True @@ -1035,7 +1035,7 @@ class AdminToolshed( AdminGalaxy ): params = dict( name=str( repository.name ), owner=str( repository.owner ) ) pathspec = [ 'repository', 'get_repository_id' ] repository_ids = util.url_get( tool_shed_url, password_mgr=self.app.tool_shed_registry.url_auth( tool_shed_url ), pathspec=pathspec, params=params ) - except Exception, e: + except Exception as e: # The Tool Shed cannot handle the get_repository_id request, so the code must be older than the # 04/2014 Galaxy release when it was introduced. It will be safest to error out and let the # Tool Shed admin update the Tool Shed to a later release. diff --git a/lib/galaxy/webapps/galaxy/controllers/async.py b/lib/galaxy/webapps/galaxy/controllers/async.py index 8aa3d46d78e..c0dca96de90 100644 --- a/lib/galaxy/webapps/galaxy/controllers/async.py +++ b/lib/galaxy/webapps/galaxy/controllers/async.py @@ -136,7 +136,7 @@ class ASync( BaseUIController ): if not text.endswith('OK'): raise Exception( text ) data.state = data.blurb = data.states.RUNNING - except Exception, e: + except Exception as e: data.info = str(e) data.state = data.blurb = data.states.ERROR diff --git a/lib/galaxy/webapps/galaxy/controllers/biostar.py b/lib/galaxy/webapps/galaxy/controllers/biostar.py index dfad8302847..bb5523ea868 100644 --- a/lib/galaxy/webapps/galaxy/controllers/biostar.py +++ b/lib/galaxy/webapps/galaxy/controllers/biostar.py @@ -19,7 +19,7 @@ class BiostarController( BaseUIController ): """ try: url, payload = biostar.get_biostar_url( trans.app, payload=payload, biostar_action=biostar_action ) - except Exception, e: + except Exception as e: return error( str( e ) ) # Only create/log in biostar user if is registered Galaxy user if trans.user: @@ -85,7 +85,7 @@ class BiostarController( BaseUIController ): try: error_reporter = biostar.BiostarErrorReporter( hda, trans.app ) payload = error_reporter.send_report( trans.user, email=email, message=message ) - except Exception, e: + except Exception as e: return error( str( e ) ) return self.biostar_redirect( trans, payload=payload, biostar_action='new_post' ) @@ -96,7 +96,7 @@ class BiostarController( BaseUIController ): """ try: url = biostar.biostar_log_out( trans ) - except Exception, e: + except Exception as e: return error( str( e ) ) if url: return trans.response.send_redirect( url ) diff --git a/lib/galaxy/webapps/galaxy/controllers/data_manager.py b/lib/galaxy/webapps/galaxy/controllers/data_manager.py index 34820e17495..28056ee0219 100644 --- a/lib/galaxy/webapps/galaxy/controllers/data_manager.py +++ b/lib/galaxy/webapps/galaxy/controllers/data_manager.py @@ -48,7 +48,7 @@ class DataManager( BaseUIController ): try: job_id = trans.security.decode_id( job_id ) job = trans.sa_session.query( trans.app.model.Job ).get( job_id ) - except Exception, e: + except Exception as e: job = None log.error( "Bad job id (%s) passed to view_job: %s" % ( job_id, e ) ) if not job: @@ -61,7 +61,7 @@ class DataManager( BaseUIController ): for hda in hdas: try: data_manager_json = loads( open( hda.get_file_name() ).read() ) - except Exception, e: + except Exception as e: data_manager_json = {} error_messages.append( escape( "Unable to obtain data_table info for hda (%s): %s" % ( hda.id, e ) ) ) values = [] diff --git a/lib/galaxy/webapps/galaxy/controllers/dataset.py b/lib/galaxy/webapps/galaxy/controllers/dataset.py index 5076686a9ab..ee415300c2a 100644 --- a/lib/galaxy/webapps/galaxy/controllers/dataset.py +++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py @@ -167,7 +167,7 @@ class DatasetInterface( BaseUIController, UsesAnnotations, UsesItemRatings, Uses error_reporter = EmailErrorReporter( id, trans.app ) error_reporter.send_report( user=trans.user, email=email, message=message ) return trans.show_ok_message( "Your error report has been sent" ) - except Exception, e: + except Exception as e: return trans.show_error_message( "An error occurred sending the report by email: %s" % str( e ) ) @web.expose @@ -338,7 +338,7 @@ class DatasetInterface( BaseUIController, UsesAnnotations, UsesItemRatings, Uses # em_payload = None # try: # em_payload = loads(em_string) -# except Exception, e: +# except Exception as e: # message = 'Invalid JSON input' # error = True # if em_payload is not None: @@ -714,7 +714,7 @@ class DatasetInterface( BaseUIController, UsesAnnotations, UsesItemRatings, Uses dataset_hash, user_hash = encode_dataset_user( trans, data, user ) try: display_link = display_app.get_link( link_name, data, dataset_hash, user_hash, trans, app_kwds ) - except Exception, e: + except Exception as e: log.debug( "Error generating display_link: %s", e ) # User can sometimes recover from, e.g. conversion errors by fixing input metadata, so use conflict return paste.httpexceptions.HTTPConflict( "Error generating display_link: %s" % e ) @@ -739,7 +739,7 @@ class DatasetInterface( BaseUIController, UsesAnnotations, UsesItemRatings, Uses # get param name from url param name try: action_param = display_link.get_param_name_by_url( action_param ) - except ValueError, e: + except ValueError as e: log.debug( e ) return paste.httpexceptions.HTTPNotFound( str( e ) ) value = display_link.get_param_value( action_param ) @@ -754,7 +754,7 @@ class DatasetInterface( BaseUIController, UsesAnnotations, UsesItemRatings, Uses file_name = value.file_name content_length = os.path.getsize( file_name ) rval = open( file_name ) - except OSError, e: + except OSError as e: log.debug( "Unable to access requested file in display application: %s", e ) return paste.httpexceptions.HTTPNotFound( "This file is no longer available." ) else: @@ -809,7 +809,7 @@ class DatasetInterface( BaseUIController, UsesAnnotations, UsesItemRatings, Uses trans.log_event( "Dataset id %s marked as deleted" % str(id) ) self.hda_manager.stop_creating_job( hda ) trans.sa_session.flush() - except Exception, e: + except Exception as e: msg = 'HDA deletion failed (encoded: %s, decoded: %s)' % ( dataset_id, id ) log.exception( msg + ': ' + str( e ) ) trans.log_event( msg ) @@ -907,7 +907,7 @@ class DatasetInterface( BaseUIController, UsesAnnotations, UsesItemRatings, Uses except: log.exception( 'Unable to purge dataset (%s) on purge of HDA (%s):' % ( hda.dataset.id, hda.id ) ) trans.sa_session.flush() - except Exception, exc: + except Exception as exc: msg = 'HDA purge failed (encoded: %s, decoded: %s): %s' % ( dataset_id, id, exc ) log.exception( msg ) trans.log_event( msg ) diff --git a/lib/galaxy/webapps/galaxy/controllers/history.py b/lib/galaxy/webapps/galaxy/controllers/history.py index f2c1676eb8a..5ee3f5e563c 100644 --- a/lib/galaxy/webapps/galaxy/controllers/history.py +++ b/lib/galaxy/webapps/galaxy/controllers/history.py @@ -631,7 +631,7 @@ class HistoryController( BaseUIController, SharableMixin, UsesAnnotations, UsesI contents = self.history_serializer.serialize_contents( history_to_view, 'contents', trans=trans, user=trans.user ) - except Exception, exc: + except Exception as exc: user_id = str( trans.user.id ) if trans.user else '(anonymous)' log.exception( 'Error bootstrapping history for user %s: %s', user_id, exc ) if isinstance( exc, exceptions.ItemAccessibilityException ): @@ -1273,9 +1273,9 @@ class HistoryController( BaseUIController, SharableMixin, UsesAnnotations, UsesI if self.create_item_slug( trans.sa_session, history ): trans.sa_session.flush() return_dict = { - "name" : history.name, - "link" : url_for(controller='history', action="display_by_username_and_slug", - username=history.user.username, slug=history.slug ) } + "name": history.name, + "link": url_for(controller='history', action="display_by_username_and_slug", + username=history.user.username, slug=history.slug ) } return return_dict # TODO: used in page/editor.mako @@ -1392,7 +1392,7 @@ class HistoryController( BaseUIController, SharableMixin, UsesAnnotations, UsesI history = self.history_manager.get_owned( self.decode_id( id ), trans.user, current_history=trans.history ) trans.set_history( history ) return self.history_serializer.serialize_to_view( history, view='detailed', user=trans.user, trans=trans ) - except exceptions.MessageException, msg_exc: + except exceptions.MessageException as msg_exc: trans.response.status = msg_exc.err_code.code return { 'err_msg': msg_exc.err_msg, 'err_code': msg_exc.err_code.code } diff --git a/lib/galaxy/webapps/galaxy/controllers/library_common.py b/lib/galaxy/webapps/galaxy/controllers/library_common.py index 02050585bf6..9ecab609fd9 100644 --- a/lib/galaxy/webapps/galaxy/controllers/library_common.py +++ b/lib/galaxy/webapps/galaxy/controllers/library_common.py @@ -34,7 +34,7 @@ try: # The following must be defined exactly like the # schema in ~/scripts/data_libraries/build_whoosh_index.py schema = Schema( id=STORED, name=TEXT, info=TEXT, dbkey=TEXT, message=TEXT ) -except ImportError, e: +except ImportError as e: whoosh_search_enabled = False schema = None @@ -151,7 +151,7 @@ class LibraryCommon( BaseUIController, UsesFormDefinitionsMixin, UsesExtendedMet current_user_roles=current_user_roles, message=escape( message ), status=escape( status ) ) - except Exception, e: + except Exception as e: message = 'Error attempting to display contents of library (%s): %s.' % ( escape( str( library.name ) ), str( e ) ) status = 'error' default_action = kwd.get( 'default_action', None ) @@ -1196,7 +1196,7 @@ class LibraryCommon( BaseUIController, UsesFormDefinitionsMixin, UsesExtendedMet path = os.path.abspath( os.path.join( os.path.dirname( path ), link_path ) ) if os.path.isfile( path ): files.append( path ) - except Exception, e: + except Exception as e: message = "Unable to get file list for configured %s, error: %s" % ( import_dir_desc, str( e ) ) response_code = 500 return None, response_code, message diff --git a/lib/galaxy/webapps/galaxy/controllers/requests_common.py b/lib/galaxy/webapps/galaxy/controllers/requests_common.py index e3237edd2a5..2989f65aff1 100644 --- a/lib/galaxy/webapps/galaxy/controllers/requests_common.py +++ b/lib/galaxy/webapps/galaxy/controllers/requests_common.py @@ -1176,7 +1176,7 @@ class RequestsCommon( BaseUIController, UsesFormDefinitionsMixin ): workflow_id=workflow_id, workflow_select_field=workflow_select_field, field_values=field_values ) ) - except Exception, e: + except Exception as e: if str( e ) == "'unicode' object has no attribute 'file'": message = "Select a file" else: diff --git a/lib/galaxy/webapps/galaxy/controllers/tool_runner.py b/lib/galaxy/webapps/galaxy/controllers/tool_runner.py index ed8f87540fd..2c411bd6ca9 100644 --- a/lib/galaxy/webapps/galaxy/controllers/tool_runner.py +++ b/lib/galaxy/webapps/galaxy/controllers/tool_runner.py @@ -76,7 +76,7 @@ class ToolRunner( BaseUIController ): history = tool.get_default_history_by_trans( trans, create=True ) try: vars = tool.handle_input( trans, params.__dict__, history=history ) - except Exception, e: + except Exception as e: error( str( e ) ) if len( params ) > 0: trans.log_event( 'Tool params: %s' % ( str( params ) ), tool_id=tool_id ) diff --git a/lib/galaxy/webapps/galaxy/controllers/user.py b/lib/galaxy/webapps/galaxy/controllers/user.py index 5af341c7f3b..b1fa9f67906 100644 --- a/lib/galaxy/webapps/galaxy/controllers/user.py +++ b/lib/galaxy/webapps/galaxy/controllers/user.py @@ -110,7 +110,7 @@ class User( BaseUIController, UsesFormDefinitionsMixin, CreatesUsersMixin, Creat request = consumer.begin( openid_provider_obj.op_endpoint_url ) if request is None: message = 'No OpenID services are available at %s' % openid_provider_obj.op_endpoint_url - except Exception, e: + except Exception as e: message = 'Failed to begin OpenID authentication: %s' % str( e ) if request is not None: trans.app.openid_manager.add_sreg( trans, request, required=openid_provider_obj.sreg_required, optional=openid_provider_obj.sreg_optional ) @@ -1768,7 +1768,7 @@ class User( BaseUIController, UsesFormDefinitionsMixin, CreatesUsersMixin, Creat chrom_count = int( open( chrom_count_dataset.file_name ).readline() ) attributes[ 'count' ] = chrom_count updated = True - except Exception, e: + except Exception as e: log.error( "Failed to open chrom count dataset: %s", e ) if updated: diff --git a/lib/galaxy/webapps/galaxy/controllers/visualization.py b/lib/galaxy/webapps/galaxy/controllers/visualization.py index 3ccd3622213..3eda0900eed 100644 --- a/lib/galaxy/webapps/galaxy/controllers/visualization.py +++ b/lib/galaxy/webapps/galaxy/controllers/visualization.py @@ -749,7 +749,7 @@ class VisualizationController( BaseUIController, SharableMixin, UsesVisualizatio plugin = self._get_plugin_from_registry( trans, visualization_name ) try: return plugin.render( trans=trans, embedded=embedded, **kwargs ) - except Exception, exception: + except Exception as exception: self._handle_plugin_error( trans, visualization_name, exception ) def _get_plugin_from_registry( self, trans, visualization_name ): @@ -795,7 +795,7 @@ class VisualizationController( BaseUIController, SharableMixin, UsesVisualizatio plugin = self._get_plugin_from_registry( trans, visualization.type ) try: return plugin.render_saved( visualization, trans=trans, **kwargs ) - except Exception, exception: + except Exception as exception: self._handle_plugin_error( trans, visualization.type, exception ) def _POST_to_saved( self, trans, id=None, revision=None, type=None, config=None, title=None, **kwargs ): diff --git a/lib/galaxy/webapps/tool_shed/api/repositories.py b/lib/galaxy/webapps/tool_shed/api/repositories.py index d09aca9051b..cd41e335ed8 100644 --- a/lib/galaxy/webapps/tool_shed/api/repositories.py +++ b/lib/galaxy/webapps/tool_shed/api/repositories.py @@ -303,7 +303,7 @@ class RepositoriesController( BaseAPIController ): try: # Open for reading with transparent compression. tar_archive = tarfile.open( capsule_file_path, 'r:*' ) - except tarfile.ReadError, e: + except tarfile.ReadError as e: log.debug( 'Error opening capsule file %s: %s' % ( str( capsule_file_name ), str( e ) ) ) return {} irm = capsule_manager.ImportRepositoryManager( self.app, @@ -579,7 +579,7 @@ class RepositoriesController( BaseAPIController ): message = "Successfully reset metadata on repository %s owned by %s" % \ ( str( repository.name ), str( repository.user.username ) ) results[ 'successful_count' ] += 1 - except Exception, e: + except Exception as e: message = "Error resetting metadata on repository %s owned by %s: %s" % \ ( str( repository.name ), str( repository.user.username ), str( e ) ) results[ 'unsuccessful_count' ] += 1 @@ -669,7 +669,7 @@ class RepositoriesController( BaseAPIController ): message = "Successfully reset metadata on repository %s owned by %s" % \ ( str( repository.name ), str( repository.user.username ) ) results[ 'status' ] = 'ok' - except Exception, e: + except Exception as e: message = "Error resetting metadata on repository %s owned by %s: %s" % \ ( str( repository.name ), str( repository.user.username ), str( e ) ) results[ 'status' ] = 'error' diff --git a/lib/galaxy/webapps/tool_shed/config.py b/lib/galaxy/webapps/tool_shed/config.py index 48704e649b9..d4159638e8b 100644 --- a/lib/galaxy/webapps/tool_shed/config.py +++ b/lib/galaxy/webapps/tool_shed/config.py @@ -204,7 +204,7 @@ class Configuration( object ): if path not in [ None, False ] and not os.path.isdir( path ): try: os.makedirs( path ) - except Exception, e: + except Exception as e: raise ConfigurationError( "Unable to create missing directory: %s\n%s" % ( path, e ) ) # Create the directories that it makes sense to create. for path in self.file_path, \ @@ -213,7 +213,7 @@ class Configuration( object ): if path not in [ None, False ] and not os.path.isdir( path ): try: os.makedirs( path ) - except Exception, e: + except Exception as e: raise ConfigurationError( "Unable to create missing directory: %s\n%s" % ( path, e ) ) # Check that required files exist. if not os.path.isfile( self.datatypes_config ): diff --git a/lib/galaxy/webapps/tool_shed/controllers/upload.py b/lib/galaxy/webapps/tool_shed/controllers/upload.py index f824c5f0dff..f2d0c5d7671 100644 --- a/lib/galaxy/webapps/tool_shed/controllers/upload.py +++ b/lib/galaxy/webapps/tool_shed/controllers/upload.py @@ -65,7 +65,7 @@ class UploadController( BaseUIController ): repo_url = repo_url.encode( 'ascii', 'replace' ) try: commands.clone( hg_util.get_configured_ui(), repo_url, uploaded_directory ) - except Exception, e: + except Exception as e: message = 'Error uploading via mercurial clone: %s' % basic_util.to_html_string( str( e ) ) status = 'error' basic_util.remove_dir( uploaded_directory ) @@ -74,7 +74,7 @@ class UploadController( BaseUIController ): valid_url = True try: stream = urllib.urlopen( url ) - except Exception, e: + except Exception as e: valid_url = False message = 'Error uploading file via http: %s' % str( e ) status = 'error' @@ -119,7 +119,7 @@ class UploadController( BaseUIController ): else: tar = tarfile.open( uploaded_file_name ) istar = True - except tarfile.ReadError, e: + except tarfile.ReadError as e: tar = None istar = False else: diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0002_add_tool_suite_column.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0002_add_tool_suite_column.py index 53e459241f6..6da8335d34a 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0002_add_tool_suite_column.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0002_add_tool_suite_column.py @@ -34,7 +34,7 @@ def upgrade( migrate_engine ): elif migrate_engine.name in ['postgresql', 'postgres']: default_false = "false" migrate_engine.execute( "UPDATE tool SET suite=%s" % default_false ) - except Exception, e: + except Exception as e: print "Adding suite column to the tool table failed: %s" % str( e ) log.debug( "Adding suite column to the tool table failed: %s" % str( e ) ) @@ -46,6 +46,6 @@ def downgrade( migrate_engine ): Tool_table = Table( "tool", metadata, autoload=True ) try: Tool_table.c.suite.drop() - except Exception, e: + except Exception as e: print "Dropping column suite from the tool table failed: %s" % str( e ) log.debug( "Dropping column suite from the tool table failed: %s" % str( e ) ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0003_review_and_review_association_tables.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0003_review_and_review_association_tables.py index 04089a6eb0d..b58e6e68590 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0003_review_and_review_association_tables.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0003_review_and_review_association_tables.py @@ -35,7 +35,7 @@ def upgrade(migrate_engine): metadata.reflect() try: ToolRatingAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating tool_rating_association table failed: %s" % str( e ) ) @@ -45,5 +45,5 @@ def downgrade(migrate_engine): metadata.reflect() try: ToolRatingAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping tool_rating_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0004_repository_tables.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0004_repository_tables.py index 15b83e79343..c0527ee8f3f 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0004_repository_tables.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0004_repository_tables.py @@ -53,15 +53,15 @@ def upgrade(migrate_engine): metadata.reflect() try: Repository_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating repository table failed: %s" % str( e ) ) try: RepositoryRatingAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating repository_rating_association table failed: %s" % str( e ) ) try: RepositoryCategoryAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating repository_category_association table failed: %s" % str( e ) ) @@ -71,13 +71,13 @@ def downgrade(migrate_engine): metadata.reflect() try: Repository_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping repository table failed: %s" % str( e ) ) try: RepositoryRatingAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping repository_rating_association table failed: %s" % str( e ) ) try: RepositoryCategoryAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping repository_category_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0005_drop_tool_related_tables.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0005_drop_tool_related_tables.py index e0a23398f1a..6fe967bd062 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0005_drop_tool_related_tables.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0005_drop_tool_related_tables.py @@ -37,7 +37,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table tool_category_association" ) try: ToolCategoryAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping tool_category_association table failed: %s" % str( e ) ) # Load and then drop the tool_event_association table try: @@ -46,7 +46,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table tool_event_association" ) try: ToolEventAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping tool_event_association table failed: %s" % str( e ) ) # Load and then drop the tool_rating_association table try: @@ -55,7 +55,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table tool_rating_association" ) try: ToolRatingAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping tool_rating_association table failed: %s" % str( e ) ) # Load and then drop the tool_tag_association table try: @@ -64,7 +64,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table tool_tag_association" ) try: ToolTagAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping tool_tag_association table failed: %s" % str( e ) ) # Load and then drop the tool_annotation_association table try: @@ -73,7 +73,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table tool_annotation_association" ) try: ToolAnnotationAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping tool_annotation_association table failed: %s" % str( e ) ) # Load and then drop the event table try: @@ -82,7 +82,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table event" ) try: Event_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping event table failed: %s" % str( e ) ) # Load and then drop the tool table try: @@ -91,7 +91,7 @@ def upgrade(migrate_engine): log.debug( "Failed loading table tool" ) try: Tool_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping tool table failed: %s" % str( e ) ) @@ -161,35 +161,35 @@ def downgrade(migrate_engine): # Create the event table try: Event_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating event table failed: %s" % str( e ) ) # Create the tool table try: Tool_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating tool table failed: %s" % str( e ) ) # Create the tool_category_association table try: ToolCategoryAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating tool_category_association table failed: %s" % str( e ) ) # Create the tool_event_association table try: ToolEventAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating tool_event_association table failed: %s" % str( e ) ) # Create the tool_rating_association table try: ToolRatingAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating tool_rating_association table failed: %s" % str( e ) ) # Create the tool_tag_association table try: ToolTagAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating tool_tag_association table failed: %s" % str( e ) ) # Create the tool_annotation_association table try: ToolAnnotationAssociation_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating tool_annotation_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0006_add_email_alerts_column.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0006_add_email_alerts_column.py index 4cf344b76fa..ef526a5fd3c 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0006_add_email_alerts_column.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0006_add_email_alerts_column.py @@ -31,7 +31,7 @@ def upgrade(migrate_engine): # Create c.create( Repository_table ) assert c is Repository_table.c.email_alerts - except Exception, e: + except Exception as e: print "Adding email_alerts column to the repository table failed: %s" % str( e ) log.debug( "Adding email_alerts column to the repository table failed: %s" % str( e ) ) @@ -43,6 +43,6 @@ def downgrade(migrate_engine): Repository_table = Table( "repository", metadata, autoload=True ) try: Repository_table.c.email_alerts.drop() - except Exception, e: + except Exception as e: print "Dropping column email_alerts from the repository table failed: %s" % str( e ) log.debug( "Dropping column email_alerts from the repository table failed: %s" % str( e ) ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0007_add_long_description_times_downloaded_columns.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0007_add_long_description_times_downloaded_columns.py index 2ace3ec2ed7..46d5e89fb45 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0007_add_long_description_times_downloaded_columns.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0007_add_long_description_times_downloaded_columns.py @@ -28,7 +28,7 @@ def upgrade(migrate_engine): # Create c.create( Repository_table ) assert c is Repository_table.c.long_description - except Exception, e: + except Exception as e: print "Adding long_description column to the repository table failed: %s" % str( e ) log.debug( "Adding long_description column to the repository table failed: %s" % str( e ) ) @@ -37,7 +37,7 @@ def upgrade(migrate_engine): # Create c.create( Repository_table ) assert c is Repository_table.c.times_downloaded - except Exception, e: + except Exception as e: print "Adding times_downloaded column to the repository table failed: %s" % str( e ) log.debug( "Adding times_downloaded column to the repository table failed: %s" % str( e ) ) @@ -54,11 +54,11 @@ def downgrade(migrate_engine): Repository_table = Table( "repository", metadata, autoload=True ) try: Repository_table.c.long_description.drop() - except Exception, e: + except Exception as e: print "Dropping column long_description from the repository table failed: %s" % str( e ) log.debug( "Dropping column long_description from the repository table failed: %s" % str( e ) ) try: Repository_table.c.times_downloaded.drop() - except Exception, e: + except Exception as e: print "Dropping column times_downloaded from the repository table failed: %s" % str( e ) log.debug( "Dropping column times_downloaded from the repository table failed: %s" % str( e ) ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0008_add_repository_metadata_table.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0008_add_repository_metadata_table.py index 127a14b0c9c..68100956a2e 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0008_add_repository_metadata_table.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0008_add_repository_metadata_table.py @@ -37,7 +37,7 @@ def upgrade(migrate_engine): # Create repository_metadata table. try: RepositoryMetadata_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating repository_metadata table failed: %s" % str( e ) ) @@ -48,6 +48,6 @@ def downgrade(migrate_engine): # Drop repository_metadata table. try: RepositoryMetadata_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping repository_metadata table failed: %s" % str( e ) ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0009_add_malicious_column.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0009_add_malicious_column.py index 811b6a02900..b447953d831 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0009_add_malicious_column.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0009_add_malicious_column.py @@ -34,7 +34,7 @@ def upgrade( migrate_engine ): elif migrate_engine.name in ['postgresql', 'postgres']: default_false = "false" migrate_engine.execute( "UPDATE repository_metadata SET malicious=%s" % default_false ) - except Exception, e: + except Exception as e: print "Adding malicious column to the repository_metadata table failed: %s" % str( e ) log.debug( "Adding malicious column to the repository_metadata table failed: %s" % str( e ) ) @@ -46,6 +46,6 @@ def downgrade( migrate_engine ): Repository_metadata_table = Table( "repository_metadata", metadata, autoload=True ) try: Repository_metadata_table.c.malicious.drop() - except Exception, e: + except Exception as e: print "Dropping column malicious from the repository_metadata table failed: %s" % str( e ) log.debug( "Dropping column malicious from the repository_metadata table failed: %s" % str( e ) ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0010_add_new_repo_alert_column.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0010_add_new_repo_alert_column.py index f30763eb859..fbbe62e9ba5 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0010_add_new_repo_alert_column.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0010_add_new_repo_alert_column.py @@ -36,7 +36,7 @@ def upgrade(migrate_engine): else: log.debug("unknown migrate_engine dialect") migrate_engine.execute( "UPDATE galaxy_user SET new_repo_alert=%s" % default_false ) - except Exception, e: + except Exception as e: print "Adding new_repo_alert column to the galaxy_user table failed: %s" % str( e ) log.debug( "Adding new_repo_alert column to the galaxy_user table failed: %s" % str( e ) ) @@ -48,6 +48,6 @@ def downgrade(migrate_engine): User_table = Table( "galaxy_user", metadata, autoload=True ) try: User_table.c.new_repo_alert.drop() - except Exception, e: + except Exception as e: print "Dropping column new_repo_alert from the galaxy_user table failed: %s" % str( e ) log.debug( "Dropping column new_repo_alert from the galaxy_user table failed: %s" % str( e ) ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0011_add_tool_versions_column.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0011_add_tool_versions_column.py index 3d9bf261743..0303b681313 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0011_add_tool_versions_column.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0011_add_tool_versions_column.py @@ -32,7 +32,7 @@ def upgrade(migrate_engine): # Create c.create( RepositoryMetadata_table ) assert c is RepositoryMetadata_table.c.tool_versions - except Exception, e: + except Exception as e: print "Adding tool_versions column to the repository_metadata table failed: %s" % str( e ) @@ -43,5 +43,5 @@ def downgrade(migrate_engine): RepositoryMetadata_table = Table( "repository_metadata", metadata, autoload=True ) try: RepositoryMetadata_table.c.tool_versions.drop() - except Exception, e: + except Exception as e: print "Dropping column tool_versions from the repository_metadata table failed: %s" % str( e ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0012_add_downloadable_column.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0012_add_downloadable_column.py index be9575f23a8..6f0a84013f9 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0012_add_downloadable_column.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0012_add_downloadable_column.py @@ -34,7 +34,7 @@ def upgrade(migrate_engine): elif migrate_engine.name in ['postgresql', 'postgres']: default_true = "true" migrate_engine.execute( "UPDATE repository_metadata SET downloadable=%s" % default_true ) - except Exception, e: + except Exception as e: print "Adding downloadable column to the repository_metadata table failed: %s" % str( e ) @@ -45,5 +45,5 @@ def downgrade(migrate_engine): RepositoryMetadata_table = Table( "repository_metadata", metadata, autoload=True ) try: RepositoryMetadata_table.c.downloadable.drop() - except Exception, e: + except Exception as e: print "Dropping column downloadable from the repository_metadata table failed: %s" % str( e ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0013_add_review_tables.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0013_add_review_tables.py index ac80751c3bf..6422468d048 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0013_add_review_tables.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0013_add_review_tables.py @@ -88,17 +88,17 @@ def upgrade(migrate_engine): # Create new review tables. try: Component_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating component table failed: %s" % str( e ) ) try: RepositoryReview_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating repository_review table failed: %s" % str( e ) ) try: ComponentReview_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating component_review table failed: %s" % str( e ) ) # Insert default Component values. @@ -169,17 +169,17 @@ def downgrade(migrate_engine): # Drop review tables. try: ComponentReview_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping component_review table failed: %s" % str( e ) ) try: RepositoryReview_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping repository_review table failed: %s" % str( e ) ) try: Component_table.drop() - except Exception, e: + except Exception as e: print str(e) log.debug( "Dropping component table failed: %s" % str( e ) ) # Get the id of the REVIEWER group. diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0014_add_deprecated_column.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0014_add_deprecated_column.py index 2e4e50f1df7..6e227c31e46 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0014_add_deprecated_column.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0014_add_deprecated_column.py @@ -34,7 +34,7 @@ def upgrade(migrate_engine): elif migrate_engine.name in ['postgresql', 'postgres']: default_false = "false" migrate_engine.execute( "UPDATE repository SET deprecated=%s" % default_false ) - except Exception, e: + except Exception as e: print "Adding deprecated column to the repository table failed: %s" % str( e ) log.debug( "Adding deprecated column to the repository table failed: %s" % str( e ) ) @@ -46,6 +46,6 @@ def downgrade(migrate_engine): Repository_table = Table( "repository", metadata, autoload=True ) try: Repository_table.c.deprecated.drop() - except Exception, e: + except Exception as e: print "Dropping column deprecated from the repository table failed: %s" % str( e ) log.debug( "Dropping column deprecated from the repository table failed: %s" % str( e ) ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0015_add_api_keys_table.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0015_add_api_keys_table.py index f8a783d35dd..e2ecd9c0207 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0015_add_api_keys_table.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0015_add_api_keys_table.py @@ -35,7 +35,7 @@ def upgrade(migrate_engine): metadata.reflect() try: APIKeys_table.create() - except Exception, e: + except Exception as e: log.debug( "Creating api_keys table failed: %s" % str( e ) ) @@ -45,5 +45,5 @@ def downgrade(migrate_engine): metadata.reflect() try: APIKeys_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping api_keys table failed: %s" % str( e ) ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0016_add_do_not_test_tools_functionally_correct_errors_columns.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0016_add_do_not_test_tools_functionally_correct_errors_columns.py index 164514b4bc1..d1af2ad658c 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0016_add_do_not_test_tools_functionally_correct_errors_columns.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0016_add_do_not_test_tools_functionally_correct_errors_columns.py @@ -37,7 +37,7 @@ def upgrade(migrate_engine): elif migrate_engine.name in ['postgresql', 'postgres']: default_false = "false" migrate_engine.execute( "UPDATE repository_metadata SET tools_functionally_correct=%s" % default_false ) - except Exception, e: + except Exception as e: print "Adding tools_functionally_correct column to the repository_metadata table failed: %s" % str( e ) log.debug( "Adding tools_functionally_correct column to the repository_metadata table failed: %s" % str( e ) ) c = Column( "do_not_test", Boolean, default=False, index=True ) @@ -51,7 +51,7 @@ def upgrade(migrate_engine): elif migrate_engine.name in ['postgresql', 'postgres']: default_false = "false" migrate_engine.execute( "UPDATE repository_metadata SET do_not_test=%s" % default_false ) - except Exception, e: + except Exception as e: print "Adding do_not_test column to the repository_metadata table failed: %s" % str( e ) log.debug( "Adding do_not_test column to the repository_metadata table failed: %s" % str( e ) ) c = Column( "time_last_tested", DateTime, default=None, nullable=True ) @@ -59,7 +59,7 @@ def upgrade(migrate_engine): # Create time_last_tested column c.create( RepositoryMetadata_table, index_name="ix_repository_metadata_tlt") assert c is RepositoryMetadata_table.c.time_last_tested - except Exception, e: + except Exception as e: print "Adding time_last_tested column to the repository_metadata table failed: %s" % str( e ) log.debug( "Adding time_last_tested column to the repository_metadata table failed: %s" % str( e ) ) c = Column( "tool_test_errors", JSONType, nullable=True ) @@ -67,7 +67,7 @@ def upgrade(migrate_engine): # Create tool_test_errors column c.create( RepositoryMetadata_table, index_name="ix_repository_metadata_tte") assert c is RepositoryMetadata_table.c.tool_test_errors - except Exception, e: + except Exception as e: print "Adding tool_test_errors column to the repository_metadata table failed: %s" % str( e ) log.debug( "Adding tool_test_errors column to the repository_metadata table failed: %s" % str( e ) ) @@ -79,21 +79,21 @@ def downgrade(migrate_engine): RepositoryMetadata_table = Table( "repository_metadata", metadata, autoload=True ) try: RepositoryMetadata_table.c.tool_test_errors.drop() - except Exception, e: + except Exception as e: print "Dropping column tool_test_errors from the repository_metadata table failed: %s" % str( e ) log.debug( "Dropping column tool_test_errors from the repository_metadata table failed: %s" % str( e ) ) try: RepositoryMetadata_table.c.time_last_tested.drop() - except Exception, e: + except Exception as e: print "Dropping column time_last_tested from the repository_metadata table failed: %s" % str( e ) log.debug( "Dropping column time_last_tested from the repository_metadata table failed: %s" % str( e ) ) try: RepositoryMetadata_table.c.do_not_test.drop() - except Exception, e: + except Exception as e: print "Dropping column do_not_test from the repository_metadata table failed: %s" % str( e ) log.debug( "Dropping column do_not_test from the repository_metadata table failed: %s" % str( e ) ) try: RepositoryMetadata_table.c.tools_functionally_correct.drop() - except Exception, e: + except Exception as e: print "Dropping column tools_functionally_correct from the repository_metadata table failed: %s" % str( e ) log.debug( "Dropping column tools_functionally_correct from the repository_metadata table failed: %s" % str( e ) ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0017_add_galaxy_utility_columns_to_repository_metadata_table.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0017_add_galaxy_utility_columns_to_repository_metadata_table.py index 9fa3836a975..5ee29e88d39 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0017_add_galaxy_utility_columns_to_repository_metadata_table.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0017_add_galaxy_utility_columns_to_repository_metadata_table.py @@ -36,7 +36,7 @@ def upgrade(migrate_engine): c.create( RepositoryMetadata_table, index_name="ix_repository_metadata_inc_datatypes") assert c is RepositoryMetadata_table.c.includes_datatypes migrate_engine.execute( "UPDATE repository_metadata SET includes_datatypes=%s" % default_false ) - except Exception, e: + except Exception as e: print "Adding includes_datatypes column to the repository_metadata table failed: %s" % str( e ) # Create includes_datatypes column @@ -45,7 +45,7 @@ def upgrade(migrate_engine): c.create( RepositoryMetadata_table, index_name="ix_repository_metadata_has_repo_deps") assert c is RepositoryMetadata_table.c.has_repository_dependencies migrate_engine.execute( "UPDATE repository_metadata SET has_repository_dependencies=%s" % default_false ) - except Exception, e: + except Exception as e: print "Adding has_repository_dependencies column to the repository_metadata table failed: %s" % str( e ) # Create includes_tools column @@ -54,7 +54,7 @@ def upgrade(migrate_engine): c.create( RepositoryMetadata_table, index_name="ix_repository_metadata_inc_tools") assert c is RepositoryMetadata_table.c.includes_tools migrate_engine.execute( "UPDATE repository_metadata SET includes_tools=%s" % default_false ) - except Exception, e: + except Exception as e: print "Adding includes_tools column to the repository_metadata table failed: %s" % str( e ) # Create includes_tool_dependencies column @@ -63,7 +63,7 @@ def upgrade(migrate_engine): c.create( RepositoryMetadata_table, index_name="ix_repository_metadata_inc_tool_deps") assert c is RepositoryMetadata_table.c.includes_tool_dependencies migrate_engine.execute( "UPDATE repository_metadata SET includes_tool_dependencies=%s" % default_false ) - except Exception, e: + except Exception as e: print "Adding includes_tool_dependencies column to the repository_metadata table failed: %s" % str( e ) # Create includes_workflows column @@ -72,7 +72,7 @@ def upgrade(migrate_engine): c.create( RepositoryMetadata_table, index_name="ix_repository_metadata_inc_workflows") assert c is RepositoryMetadata_table.c.includes_workflows migrate_engine.execute( "UPDATE repository_metadata SET includes_workflows=%s" % default_false ) - except Exception, e: + except Exception as e: print "Adding includes_workflows column to the repository_metadata table failed: %s" % str( e ) @@ -85,29 +85,29 @@ def downgrade(migrate_engine): # Drop the includes_workflows column. try: RepositoryMetadata_table.c.includes_workflows.drop() - except Exception, e: + except Exception as e: print "Dropping column includes_workflows from the repository_metadata table failed: %s" % str( e ) # Drop the includes_tool_dependencies column. try: RepositoryMetadata_table.c.includes_tool_dependencies.drop() - except Exception, e: + except Exception as e: print "Dropping column includes_tool_dependencies from the repository_metadata table failed: %s" % str( e ) # Drop the includes_tools column. try: RepositoryMetadata_table.c.includes_tools.drop() - except Exception, e: + except Exception as e: print "Dropping column includes_tools from the repository_metadata table failed: %s" % str( e ) # Drop the has_repository_dependencies column. try: RepositoryMetadata_table.c.has_repository_dependencies.drop() - except Exception, e: + except Exception as e: print "Dropping column has_repository_dependencies from the repository_metadata table failed: %s" % str( e ) # Drop the includes_datatypes column. try: RepositoryMetadata_table.c.includes_datatypes.drop() - except Exception, e: + except Exception as e: print "Dropping column includes_datatypes from the repository_metadata table failed: %s" % str( e ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0018_add_repository_metadata_flag_columns.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0018_add_repository_metadata_flag_columns.py index c30065a4f5c..c9e0fa7294b 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0018_add_repository_metadata_flag_columns.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0018_add_repository_metadata_flag_columns.py @@ -44,7 +44,7 @@ def upgrade(migrate_engine): try: col = RepositoryMetadata_table.c.tool_test_errors col.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping column 'tool_test_errors' from repository_metadata table failed: %s" % ( str( e ) ) ) # Create the tool_test_results column to replace the ill-named tool_test_errors column just dropped above. @@ -52,7 +52,7 @@ def upgrade(migrate_engine): try: c.create( RepositoryMetadata_table ) assert c is RepositoryMetadata_table.c.tool_test_results - except Exception, e: + except Exception as e: print "Adding tool_test_results column to the repository_metadata table failed: %s" % str( e ) # Create the missing_test_components column. @@ -61,7 +61,7 @@ def upgrade(migrate_engine): c.create( RepositoryMetadata_table, index_name="ix_repository_metadata_mtc") assert c is RepositoryMetadata_table.c.missing_test_components migrate_engine.execute( "UPDATE repository_metadata SET missing_test_components=%s" % default_false ) - except Exception, e: + except Exception as e: print "Adding missing_test_components column to the repository_metadata table failed: %s" % str( e ) @@ -74,13 +74,13 @@ def downgrade(migrate_engine): # Drop the missing_test_components column. try: RepositoryMetadata_table.c.missing_test_components.drop() - except Exception, e: + except Exception as e: print "Dropping column missing_test_components from the repository_metadata table failed: %s" % str( e ) # Drop the tool_test_results column. try: RepositoryMetadata_table.c.tool_test_results.drop() - except Exception, e: + except Exception as e: print "Dropping column tool_test_results from the repository_metadata table failed: %s" % str( e ) # Create the tool_test_errors column. @@ -88,5 +88,5 @@ def downgrade(migrate_engine): try: c.create( RepositoryMetadata_table ) assert c is RepositoryMetadata_table.c.tool_test_errors - except Exception, e: + except Exception as e: print "Adding tool_test_errors column to the repository_metadata table failed: %s" % str( e ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0019_add_skip_tool_test_table_and_test_install_error_column.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0019_add_skip_tool_test_table_and_test_install_error_column.py index 43948971930..d32d1bd9504 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0019_add_skip_tool_test_table_and_test_install_error_column.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0019_add_skip_tool_test_table_and_test_install_error_column.py @@ -55,13 +55,13 @@ def upgrade( migrate_engine ): c.create( RepositoryMetadata_table, index_name="ix_repository_metadata_ttie") assert c is RepositoryMetadata_table.c.test_install_error migrate_engine.execute( "UPDATE repository_metadata SET test_install_error=%s" % default_false ) - except Exception, e: + except Exception as e: print "Adding test_install_error column to the repository_metadata table failed: %s" % str( e ) # Create skip_tool_test table. try: SkipToolTest_table.create() - except Exception, e: + except Exception as e: print "Creating the skip_tool_test table failed: %s" % str( e ) @@ -72,12 +72,12 @@ def downgrade( migrate_engine ): # Drop the skip_tool_test table. try: SkipToolTest_table.drop() - except Exception, e: + except Exception as e: print "Dropping the skip_tool_test table failed: %s" % str( e ) # Drop test_install_error column from the repository_metadata table. RepositoryMetadata_table = Table( "repository_metadata", metadata, autoload=True ) try: RepositoryMetadata_table.c.test_install_error.drop() - except Exception, e: + except Exception as e: print "Dropping column test_install_error from the repository_metadata table failed: %s" % str( e ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0020_add_repository_type_column.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0020_add_repository_type_column.py index ec1622ea964..8936cc47851 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0020_add_repository_type_column.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0020_add_repository_type_column.py @@ -28,7 +28,7 @@ def upgrade( migrate_engine ): # Create c.create( Repository_table, index_name="ix_repository_type" ) assert c is Repository_table.c.type - except Exception, e: + except Exception as e: print "Adding type column to the repository table failed: %s" % str( e ) # Update the type column to have the default unrestricted value. cmd = "UPDATE repository SET type = 'unrestricted'" @@ -42,5 +42,5 @@ def downgrade( migrate_engine ): Repository_table = Table( "repository", metadata, autoload=True ) try: Repository_table.c.type.drop() - except Exception, e: + except Exception as e: print "Dropping column type from the repository table failed: %s" % str( e ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0022_add_repository_admin_roles.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0022_add_repository_admin_roles.py index 7dca5f49400..09440fe4eb9 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0022_add_repository_admin_roles.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0022_add_repository_admin_roles.py @@ -65,7 +65,7 @@ def upgrade( migrate_engine ): # Create the new repository_role_association table. try: RepositoryRoleAssociation_table.create() - except Exception, e: + except Exception as e: print str(e) log.debug( "Creating repository_role_association table failed: %s" % str( e ) ) # Select the list of repositories and associated public user names for their owners. @@ -159,5 +159,5 @@ def downgrade( migrate_engine ): log.debug( "Failed loading table repository_role_association" ) try: RepositoryRoleAssociation_table.drop() - except Exception, e: + except Exception as e: log.debug( "Dropping repository_role_association table failed: %s" % str( e ) ) diff --git a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0023_add_repository_url_and_hompeage_url.py b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0023_add_repository_url_and_hompeage_url.py index aa8b624c6ac..dac67339257 100644 --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0023_add_repository_url_and_hompeage_url.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0023_add_repository_url_and_hompeage_url.py @@ -33,7 +33,7 @@ def upgrade( migrate_engine ): c_homepage.create( Repository_table ) assert c_remote is Repository_table.c.remote_repository_url assert c_homepage is Repository_table.c.homepage_url - except Exception, e: + except Exception as e: print "Adding remote_repository_url and homepage_url columns to the repository table failed: %s" % str( e ) @@ -45,5 +45,5 @@ def downgrade( migrate_engine ): try: Repository_table.c.remote_repository_url.drop() Repository_table.c.homepage_url.drop() - except Exception, e: + except Exception as e: print "Dropping columns remote_repository_url and homepage_url from the repository table failed: %s" % str( e ) diff --git a/lib/galaxy/webapps/tool_shed/util/hgweb_config.py b/lib/galaxy/webapps/tool_shed/util/hgweb_config.py index cdea96c8fb8..05953a2edd9 100644 --- a/lib/galaxy/webapps/tool_shed/util/hgweb_config.py +++ b/lib/galaxy/webapps/tool_shed/util/hgweb_config.py @@ -33,7 +33,7 @@ class HgWebConfigManager( object ): self.in_memory_config.set( 'paths', lhs, rhs ) # Persist our in-memory configuration. self.write_config() - except Exception, e: + except Exception as e: log.debug( "Exception in HgWebConfigManager.add_entry(): %s" % str( e ) ) finally: lock.release() @@ -50,7 +50,7 @@ class HgWebConfigManager( object ): self.in_memory_config.set( 'paths', new_lhs, new_rhs ) # Persist our in-memory configuration. self.write_config() - except Exception, e: + except Exception as e: log.debug( "Exception in HgWebConfigManager.change_entry(): %s" % str( e ) ) finally: lock.release() diff --git a/lib/galaxy/workflow/modules.py b/lib/galaxy/workflow/modules.py index 2d6212bfa2b..bdab79683f7 100644 --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -1060,7 +1060,7 @@ class ToolModule( WorkflowModule ): try: # Replace DummyDatasets with historydatasetassociations visit_input_values( tool.inputs, execution_state.inputs, callback, no_replacement_value=NO_REPLACEMENT ) - except KeyError, k: + except KeyError as k: message_template = "Error due to input mapping of '%s' in '%s'. A common cause of this is conditional outputs that cannot be determined until runtime, please review your workflow." message = message_template % (tool.name, k.message) raise exceptions.MessageException( message ) diff --git a/lib/galaxy_ext/metadata/set_metadata.py b/lib/galaxy_ext/metadata/set_metadata.py index 6fc08d5dda2..a540ff36df5 100644 --- a/lib/galaxy_ext/metadata/set_metadata.py +++ b/lib/galaxy_ext/metadata/set_metadata.py @@ -137,7 +137,7 @@ def set_metadata(): dataset.metadata.remove_key(k) dataset.metadata.to_JSON_dict( filename_out ) # write out results of set_meta json.dump( ( True, 'Metadata has been set successfully' ), open( filename_results_code, 'wb+' ) ) # setting metadata has succeeded - except Exception, e: + except Exception as e: json.dump( ( False, str( e ) ), open( filename_results_code, 'wb+' ) ) # setting metadata has failed somehow for i, ( filename, file_dict ) in enumerate( new_job_metadata_dict.iteritems(), start=1 ): diff --git a/lib/galaxy_utils/sequence/fastq.py b/lib/galaxy_utils/sequence/fastq.py index 88097206ec9..aa3be1187b4 100644 --- a/lib/galaxy_utils/sequence/fastq.py +++ b/lib/galaxy_utils/sequence/fastq.py @@ -96,7 +96,7 @@ class fastqSequencingRead( SequencingRead ): try: to_quality = self.ascii_min - self.quality_min return [ chr( int( val ) + to_quality ) for val in quality.split() ] - except ValueError, e: + except ValueError as e: raise ValueError( 'Error Parsing quality String. ASCII quality strings cannot contain spaces (%s): %s' % ( self.quality, e ) ) else: return [] @@ -113,7 +113,7 @@ class fastqSequencingRead( SequencingRead ): if quality: try: return len( quality.split() ) - except ValueError, e: + except ValueError as e: raise ValueError( 'Error Parsing quality String. ASCII quality strings cannot contain spaces (%s): %s' % ( self.quality, e ) ) else: return 0 @@ -602,9 +602,9 @@ class fastqVerboseErrorReader( fastqReader ): block = super( fastqVerboseErrorReader, self ).next() self.last_good_identifier = block.identifier return block - except StopIteration, e: + except StopIteration as e: raise e - except Exception, e: + except Exception as e: print "There was an error reading your input file. Your input file is likely malformed.\nIt is suggested that you double-check your original input file for errors -- helpful information for this purpose has been provided below.\nHowever, if you think that you have encountered an actual error with this tool, please do tell us by using the bug reporting mechanism.\n\nThe reported error is: '%s'." % e if self.last_good_identifier is not None: print "The last valid FASTQ read had an identifier of '%s'." % self.last_good_identifier diff --git a/lib/tool_shed/capsule/capsule_manager.py b/lib/tool_shed/capsule/capsule_manager.py index 3e1526c675a..dc1d6483071 100644 --- a/lib/tool_shed/capsule/capsule_manager.py +++ b/lib/tool_shed/capsule/capsule_manager.py @@ -109,7 +109,7 @@ class ExportRepositoryManager( object ): exported_repository_root.append( exported_repository_elem ) tmp_manifest = xml_util.create_and_write_tmp_file( exported_repository_root, use_indent=True ) repositories_archive.add( tmp_manifest, arcname='manifest.xml' ) - except Exception, e: + except Exception as e: log.exception( str( e ) ) finally: if os.path.exists( tmp_export_info ): @@ -517,7 +517,7 @@ class ImportRepositoryManager( object ): tar_archive.extractall( path=file_path ) try: tar_archive.close() - except Exception, e: + except Exception as e: log.exception( "Cannot close tar_archive: %s" % str( e ) ) del return_dict[ 'tar_archive' ] return return_dict @@ -792,7 +792,7 @@ class ImportRepositoryManager( object ): if error_message: results_dict[ 'ok' ] = False results_dict[ 'error_message' ] += error_message - except Exception, e: + except Exception as e: log.debug( "Error setting metadata on repository %s created from imported archive %s: %s" % ( str( repository.name ), str( archive_file_name ), str( e ) ) ) else: @@ -822,7 +822,7 @@ class ImportRepositoryManager( object ): valid_url = True try: stream = urllib.urlopen( url ) - except Exception, e: + except Exception as e: valid_url = False return_dict['error_message'] = 'Error importing file via http: %s' % str( e ) return_dict['status'] = 'error' @@ -850,7 +850,7 @@ class ImportRepositoryManager( object ): try: # Open for reading with transparent compression. tar_archive = tarfile.open( uploaded_file_name, 'r:*' ) - except tarfile.ReadError, e: + except tarfile.ReadError as e: error_message = 'Error opening file %s: %s' % ( str( uploaded_file_name ), str( e ) ) log.exception( error_message ) return_dict[ 'error_message' ] = error_message diff --git a/lib/tool_shed/galaxy_install/dependency_display.py b/lib/tool_shed/galaxy_install/dependency_display.py index b5600bf3c66..ea6407c4adf 100644 --- a/lib/tool_shed/galaxy_install/dependency_display.py +++ b/lib/tool_shed/galaxy_install/dependency_display.py @@ -318,7 +318,7 @@ class DependencyDisplayer( object ): if tool_dependencies_root_folder: tool_dependencies_root_folder.folders.append( tool_dependencies_folder ) new_containers_dict[ 'tool_dependencies' ] = tool_dependencies_root_folder - except Exception, e: + except Exception as e: log.debug( "Exception in merge_containers_dicts_for_new_install: %s" % str( e ) ) finally: lock.release() diff --git a/lib/tool_shed/galaxy_install/install_manager.py b/lib/tool_shed/galaxy_install/install_manager.py index 6fa27fe1c08..963c1753c73 100644 --- a/lib/tool_shed/galaxy_install/install_manager.py +++ b/lib/tool_shed/galaxy_install/install_manager.py @@ -122,7 +122,7 @@ class InstallToolDependencyManager( object ): try: # There is currently only one fabric method. tool_dependency = self.install_and_build_package( install_environment, tool_dependency, actions_dict ) - except Exception, e: + except Exception as e: log.exception( 'Error installing tool dependency %s version %s.', str( tool_dependency.name ), str( tool_dependency.version ) ) # Since there was an installation error, update the tool dependency status to Error. The remove_installation_path option must # be left False here. @@ -177,7 +177,7 @@ class InstallToolDependencyManager( object ): attr_tup = ( name, version, type ) try: index = attr_tups_of_dependencies_for_install.index( attr_tup ) - except Exception, e: + except Exception as e: index = None if index is not None: tool_dependency = tool_dependencies[ index ] @@ -197,7 +197,7 @@ class InstallToolDependencyManager( object ): tool_shed_repository, tool_dependencies=tool_dependencies, from_tool_migration_manager=from_tool_migration_manager ) - except Exception, e: + except Exception as e: error_message = "Error installing tool dependency %s version %s: %s" % \ ( str( name ), str( version ), str( e ) ) log.exception( error_message ) @@ -461,7 +461,7 @@ class InstallRepositoryManager( object ): pathspec = [ 'api', 'repositories', 'get_repository_revision_install_info' ] try: raw_text = util.url_get( tool_shed_url, password_mgr=self.app.tool_shed_registry.url_auth( tool_shed_url ), pathspec=pathspec, params=params ) - except Exception, e: + except Exception as e: message = "Error attempting to retrieve installation information from tool shed " message += "%s for revision %s of repository %s owned by %s: %s" % \ ( str( tool_shed_url ), str( changeset_revision ), str( name ), str( owner ), str( e ) ) diff --git a/lib/tool_shed/galaxy_install/installed_repository_manager.py b/lib/tool_shed/galaxy_install/installed_repository_manager.py index aa7462b2a70..f9f942424db 100644 --- a/lib/tool_shed/galaxy_install/installed_repository_manager.py +++ b/lib/tool_shed/galaxy_install/installed_repository_manager.py @@ -605,7 +605,7 @@ class InstalledRepositoryManager( object ): if env_shell_file_path is not None: try: contents = open( env_shell_file_path, 'r' ).read() - except Exception, e: + except Exception as e: contents = None log.debug( 'Error reading file %s, so cannot determine if package %s requires package %s at run time: %s' % ( str( env_shell_file_path ), str( td.name ), str( tool_dependency.name ), str( e ) ) ) @@ -768,7 +768,7 @@ class InstalledRepositoryManager( object ): try: sa_session.delete( tool_version_association ) sa_session.flush() - except Exception, e: + except Exception as e: status = 'error' message = 'Error attempting to purge tool_versions for the repository named %s with status %s: %s.' % \ ( str( repository.name ), str( repository.status ), str( e ) ) @@ -778,7 +778,7 @@ class InstalledRepositoryManager( object ): try: sa_session.delete( tool_version_association ) sa_session.flush() - except Exception, e: + except Exception as e: status = 'error' message = 'Error attempting to purge tool_versions for the repository named %s with status %s: %s.' % \ ( str( repository.name ), str( repository.status ), str( e ) ) @@ -787,7 +787,7 @@ class InstalledRepositoryManager( object ): sa_session.delete( tool_version ) sa_session.flush() purged_tool_versions += 1 - except Exception, e: + except Exception as e: status = 'error' message = 'Error attempting to purge tool_versions for the repository named %s with status %s: %s.' % \ ( str( repository.name ), str( repository.status ), str( e ) ) @@ -799,7 +799,7 @@ class InstalledRepositoryManager( object ): sa_session.delete( tool_dependency ) sa_session.flush() purged_tool_dependencies += 1 - except Exception, e: + except Exception as e: status = 'error' message = 'Error attempting to purge tool_dependencies for the repository named %s with status %s: %s.' % \ ( str( repository.name ), str( repository.status ), str( e ) ) @@ -811,7 +811,7 @@ class InstalledRepositoryManager( object ): sa_session.delete( rrda ) sa_session.flush() purged_required_repositories += 1 - except Exception, e: + except Exception as e: status = 'error' message = 'Error attempting to purge required_repositories for the repository named %s with status %s: %s.' % \ ( str( repository.name ), str( repository.status ), str( e ) ) @@ -830,7 +830,7 @@ class InstalledRepositoryManager( object ): sa_session.delete( orphan_rrda ) sa_session.flush() purged_orphan_repository_repository_dependency_association_records += 1 - except Exception, e: + except Exception as e: status = 'error' message = 'Error attempting to purge repository_repository_dependency_association records associated with ' message += 'an orphan repository_dependency record for the repository named %s with status %s: %s.' % \ @@ -840,7 +840,7 @@ class InstalledRepositoryManager( object ): sa_session.delete( orphan_repository_dependency ) sa_session.flush() purged_orphan_repository_dependency_records += 1 - except Exception, e: + except Exception as e: status = 'error' message = 'Error attempting to purge orphan repository_dependency records for the repository named %s with status %s: %s.' % \ ( str( repository.name ), str( repository.status ), str( e ) ) diff --git a/lib/tool_shed/galaxy_install/repair_repository_manager.py b/lib/tool_shed/galaxy_install/repair_repository_manager.py index e28cf104658..bb84241f8e8 100644 --- a/lib/tool_shed/galaxy_install/repair_repository_manager.py +++ b/lib/tool_shed/galaxy_install/repair_repository_manager.py @@ -162,7 +162,7 @@ class RepairRepositoryManager(): if repository.status in [ self.app.install_model.ToolShedRepository.installation_status.DEACTIVATED ]: try: self.app.installed_repository_manager.activate_repository( repository ) - except Exception, e: + except Exception as e: error_message = "Error activating repository %s: %s" % ( repository.name, str( e ) ) log.debug( error_message ) repair_dict[ repository.name ] = error_message diff --git a/lib/tool_shed/galaxy_install/repository_dependencies/repository_dependency_manager.py b/lib/tool_shed/galaxy_install/repository_dependencies/repository_dependency_manager.py index a69c0357aec..6108a15272b 100644 --- a/lib/tool_shed/galaxy_install/repository_dependencies/repository_dependency_manager.py +++ b/lib/tool_shed/galaxy_install/repository_dependencies/repository_dependency_manager.py @@ -292,7 +292,7 @@ class RepositoryDependencyInstallManager( object ): pathspec = [ 'repository', 'get_repository_dependencies' ] try: raw_text = url_get( tool_shed_url, password_mgr=app.tool_shed_registry.url_auth( tool_shed_url ), pathspec=pathspec, params=params ) - except Exception, e: + except Exception as e: log.error("The URL\n%s\nraised the exception:\n%s\n", build_url( tool_shed_url, pathspec=pathspec, params=params ), str( e ) ) return '' if len( raw_text ) > 2: @@ -386,7 +386,7 @@ class RepositoryDependencyInstallManager( object ): if response: try: required_repo_info_dict = json.loads( response ) - except Exception, e: + except Exception as e: log.exception( e ) return all_repo_info_dicts required_repo_info_dicts = [] diff --git a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/env_file_builder.py b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/env_file_builder.py index ea0552f0107..95d37136e52 100644 --- a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/env_file_builder.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/env_file_builder.py @@ -49,7 +49,7 @@ class EnvFileBuilder( object ): if not os.path.exists( file_dir ): try: os.makedirs( file_dir ) - except Exception, e: + except Exception as e: log.exception( str( e ) ) return 1 if os.path.exists( file_path ): @@ -62,7 +62,7 @@ class EnvFileBuilder( object ): if line: new_env_file_contents.append( line ) env_file_contents = new_env_file_contents - except Exception, e: + except Exception as e: log.exception( str( e ) ) return 1 else: @@ -73,7 +73,7 @@ class EnvFileBuilder( object ): # Explicitly set the file's executable bits. try: os.chmod( file_path, int( '111', base=8 ) | os.stat( file_path )[ stat.ST_MODE ] ) - except Exception, e: + except Exception as e: log.exception( str( e ) ) return 1 # Convert the received text to a list, in order to support adding one or more lines to the file. @@ -85,7 +85,7 @@ class EnvFileBuilder( object ): env_file_contents.append( line ) try: file( file_path, 'w' ).write( '\n'.join( env_file_contents ) ) - except Exception, e: + except Exception as e: log.exception( str( e ) ) return 1 return 0 diff --git a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/install_environment.py b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/install_environment.py index 0118cde2605..3b0da20ee21 100644 --- a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/install_environment.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/install_environment.py @@ -59,7 +59,7 @@ class InstallEnvironment( object ): try: fd.close() break - except IOError, e: + except IOError as e: # Undoubtedly close() was called during a concurrent operation on the same file object. log.debug( 'Error closing file descriptor: %s' % str( e ) ) time.sleep( .5 ) @@ -265,7 +265,7 @@ class InstallEnvironment( object ): if os.path.exists( work_dir ): try: shutil.rmtree( work_dir ) - except Exception, e: + except Exception as e: log.exception( str( e ) ) def __setup_environment( self ): diff --git a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py index bcb0d0edda7..bdd8c82f05f 100755 --- a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py @@ -179,7 +179,7 @@ class Download( object ): err_msg = 'Downloading from URL %s took longer than the defined timeout period of %.1f seconds.' % \ ( str( download_url ), basic_util.NO_OUTPUT_TIMEOUT ) raise Exception( err_msg ) - except Exception, e: + except Exception as e: err_msg = err_msg = 'Error downloading from URL\n%s:\n%s' % ( str( download_url ), str( e ) ) raise Exception( err_msg ) finally: @@ -605,7 +605,7 @@ class DownloadBinary( Download, RecipeStep ): # Set actions to the same, so that the current download_binary doesn't get re-run in the # next stage. TODO: this may no longer be necessary... actions = [ item for item in filtered_actions ] - except Exception, e: + except Exception as e: log.exception( str( e ) ) if initial_download: # No binary exists, or there was an error downloading the binary from the generated URL. diff --git a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/tag_handler.py b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/tag_handler.py index d505325a8be..13c031f288e 100644 --- a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/tag_handler.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/tag_handler.py @@ -103,7 +103,7 @@ class SyncDatabase( object ): try: log.debug( "Returning from sync_database_with_file_system with tool_dependency %s, can_install_tool_dependency %s." % ( str( tool_dependency.name ), str( can_install_tool_dependency ) ) ) - except Exception, e: + except Exception as e: log.debug( str( e ) ) return tool_dependency, can_install_tool_dependency @@ -523,7 +523,7 @@ class SetEnvironment( RecipeTag ): attr_tups_of_dependencies_for_install = [ ( td.name, td.version, td.type ) for td in tool_dependency_db_records ] try: self.set_environment( package_elem, tool_shed_repository, attr_tups_of_dependencies_for_install ) - except Exception, e: + except Exception as e: error_message = "Error setting environment for tool dependency: %s" % str( e ) log.debug( error_message ) return tool_dependency, proceed_with_install, action_elem_tuples diff --git a/lib/tool_shed/galaxy_install/tool_migration_manager.py b/lib/tool_shed/galaxy_install/tool_migration_manager.py index 104a0d84547..2d75d940f1f 100644 --- a/lib/tool_shed/galaxy_install/tool_migration_manager.py +++ b/lib/tool_shed/galaxy_install/tool_migration_manager.py @@ -411,7 +411,7 @@ class ToolMigrationManager( object ): lock.acquire( True ) try: self.filter_and_persist_proprietary_tool_panel_configs( tool_configs_to_filter ) - except Exception, e: + except Exception as e: log.exception( "Exception attempting to filter and persist non-shed-related tool panel configs:\n%s" % str( e ) ) finally: lock.release() diff --git a/lib/tool_shed/galaxy_install/tools/data_manager.py b/lib/tool_shed/galaxy_install/tools/data_manager.py index 35c4f7b4d18..7acf0bec5ca 100644 --- a/lib/tool_shed/galaxy_install/tools/data_manager.py +++ b/lib/tool_shed/galaxy_install/tools/data_manager.py @@ -27,7 +27,7 @@ class DataManagerHandler( object ): fh.write( xml_util.xml_to_string( elem ) ) fh.write( '\n' ) fh.close() - except Exception, e: + except Exception as e: log.exception( "Exception in DataManagerHandler.data_manager_config_elems_to_xml_file: %s" % str( e ) ) finally: lock.release() diff --git a/lib/tool_shed/galaxy_install/tools/tool_panel_manager.py b/lib/tool_shed/galaxy_install/tools/tool_panel_manager.py index 1e51200e5f1..2db27488dc9 100644 --- a/lib/tool_shed/galaxy_install/tools/tool_panel_manager.py +++ b/lib/tool_shed/galaxy_install/tools/tool_panel_manager.py @@ -83,7 +83,7 @@ class ToolPanelManager( object ): fh.write( xml_util.xml_to_string( elem, use_indent=True ) ) fh.write( '\n' ) fh.close() - except Exception, e: + except Exception as e: log.exception( "Exception in ToolPanelManager.config_elems_to_xml_file: %s" % str( e ) ) finally: lock.release() diff --git a/lib/tool_shed/galaxy_install/update_repository_manager.py b/lib/tool_shed/galaxy_install/update_repository_manager.py index aa8e60e9b61..3861bb4e2cf 100644 --- a/lib/tool_shed/galaxy_install/update_repository_manager.py +++ b/lib/tool_shed/galaxy_install/update_repository_manager.py @@ -60,7 +60,7 @@ class UpdateRepositoryManager( object ): changeset_revision_dict[ 'has_repository_dependencies_only_if_compiling_contained_td' ] = has_repository_dependencies_only_if_compiling_contained_td changeset_revision_dict[ 'changeset_revision' ] = changeset_revision changeset_revision_dict[ 'ctx_rev' ] = ctx_rev - except Exception, e: + except Exception as e: log.debug( "Error getting change set revision for update from the tool shed for repository '%s': %s" % ( repository.name, str( e ) ) ) changeset_revision_dict[ 'includes_data_managers' ] = False changeset_revision_dict[ 'includes_datatypes' ] = False diff --git a/lib/tool_shed/galaxy_install/utility_containers/__init__.py b/lib/tool_shed/galaxy_install/utility_containers/__init__.py index 6492f55092c..302679d6e67 100644 --- a/lib/tool_shed/galaxy_install/utility_containers/__init__.py +++ b/lib/tool_shed/galaxy_install/utility_containers/__init__.py @@ -137,7 +137,7 @@ class GalaxyUtilityContainerManager( utility_container_manager.UtilityContainerM error_messages=data_managers_errors, label='Invalid Data Managers' ) containers_dict[ 'invalid_data_managers' ] = invalid_data_managers_root_folder - except Exception, e: + except Exception as e: log.debug( "Exception in build_repository_containers: %s" % str( e ) ) finally: lock.release() diff --git a/lib/tool_shed/metadata/metadata_generator.py b/lib/tool_shed/metadata/metadata_generator.py index d51c042693f..12047236cca 100644 --- a/lib/tool_shed/metadata/metadata_generator.py +++ b/lib/tool_shed/metadata/metadata_generator.py @@ -446,7 +446,7 @@ class MetadataGenerator( object ): valid_exported_galaxy_workflow = True try: exported_workflow_dict = json.loads( workflow_text ) - except Exception, e: + except Exception as e: log.exception( "Skipping file %s since it does not seem to be a valid exported Galaxy workflow: %s" % ( str( relative_path ), str( e ) ) ) valid_exported_galaxy_workflow = False diff --git a/lib/tool_shed/repository_registry.py b/lib/tool_shed/repository_registry.py index 4271080f0c7..0554a4e4bad 100644 --- a/lib/tool_shed/repository_registry.py +++ b/lib/tool_shed/repository_registry.py @@ -93,7 +93,7 @@ class Registry( object ): self.load_repository_and_suite_tuple( repository ) if is_level_one_certified: self.load_certified_level_one_repository_and_suite_tuple( repository ) - except Exception, e: + except Exception as e: # The viewable repository numbers and the categorized (filtered) lists of repository tuples # may be slightly skewed, but that is no reason to result in a potential server error. All # will be corrected at next server start. @@ -341,7 +341,7 @@ class Registry( object ): self.unload_repository_and_suite_tuple( repository ) if is_level_one_certified: self.unload_certified_level_one_repository_and_suite_tuple( repository ) - except Exception, e: + except Exception as e: # The viewable repository numbers and the categorized (filtered) lists of repository tuples # may be slightly skewed, but that is no reason to result in a potential server error. All # will be corrected at next server start. diff --git a/lib/tool_shed/tool_shed_registry.py b/lib/tool_shed/tool_shed_registry.py index 6014ee5b414..56023004923 100644 --- a/lib/tool_shed/tool_shed_registry.py +++ b/lib/tool_shed/tool_shed_registry.py @@ -34,7 +34,7 @@ class Registry( object ): pass_mgr = urlrequest.HTTPPasswordMgrWithDefaultRealm() pass_mgr.add_password( None, url, username, password ) self.tool_sheds_auth[ name ] = pass_mgr - except Exception, e: + except Exception as e: log.warning( 'Error loading reference to tool shed "%s", problem: %s' % ( name, str( e ) ) ) def password_manager_for_url( self, url ): diff --git a/lib/tool_shed/tools/data_table_manager.py b/lib/tool_shed/tools/data_table_manager.py index ae4b8595685..b6137f41e85 100644 --- a/lib/tool_shed/tools/data_table_manager.py +++ b/lib/tool_shed/tools/data_table_manager.py @@ -107,7 +107,7 @@ class ToolDataTableManager( object ): persist=persist ) if message: error = True - except Exception, e: + except Exception as e: message = str( e ) error = True return error, message diff --git a/lib/tool_shed/tools/tool_validator.py b/lib/tool_shed/tools/tool_validator.py index 1502c896de0..faff4f9d165 100644 --- a/lib/tool_shed/tools/tool_validator.py +++ b/lib/tool_shed/tools/tool_validator.py @@ -295,13 +295,13 @@ class ToolValidator( object ): tool = self.app.toolbox.load_tool( full_path, repository_id=repository_id, allow_code_files=False, use_cached=False ) valid = True error_message = None - except KeyError, e: + except KeyError as e: tool = None valid = False error_message = 'This file requires an entry for "%s" in the tool_data_table_conf.xml file. Upload a file ' % str( e ) error_message += 'named tool_data_table_conf.xml.sample to the repository that includes the required entry to correct ' error_message += 'this error. ' - except Exception, e: + except Exception as e: tool = None valid = False error_message = str( e ) diff --git a/lib/tool_shed/util/basic_util.py b/lib/tool_shed/util/basic_util.py index 3d530dbde3b..02822546567 100644 --- a/lib/tool_shed/util/basic_util.py +++ b/lib/tool_shed/util/basic_util.py @@ -143,7 +143,7 @@ def to_html_string( text ): if text: try: text = unicodify( text ) - except UnicodeDecodeError, e: + except UnicodeDecodeError as e: return "Error decoding string: %s" % str( e ) text = text_type( markupsafe.escape( text ) ) text = text.replace( '\n', '
' ) diff --git a/lib/tool_shed/util/commit_util.py b/lib/tool_shed/util/commit_util.py index 76cbd35e73a..ccceef68762 100644 --- a/lib/tool_shed/util/commit_util.py +++ b/lib/tool_shed/util/commit_util.py @@ -176,7 +176,7 @@ def handle_directory_changes( app, host, username, repository, full_path, filena # the uploaded archive. try: hg_util.remove_file( repo.ui, repo, repo_file, force=True ) - except Exception, e: + except Exception as e: log.debug( "Error removing files using the mercurial API, so trying a different approach, the error was: %s" % str( e )) relative_selected_file = repo_file.split( 'repo_%d' % repository.id )[1].lstrip( '/' ) repo.dirstate.remove( relative_selected_file ) @@ -185,7 +185,7 @@ def handle_directory_changes( app, host, username, repository, full_path, filena if os.path.isdir( absolute_selected_file ): try: os.rmdir( absolute_selected_file ) - except OSError, e: + except OSError as e: # The directory is not empty. pass elif os.path.isfile( absolute_selected_file ): @@ -193,7 +193,7 @@ def handle_directory_changes( app, host, username, repository, full_path, filena dir = os.path.split( absolute_selected_file )[0] try: os.rmdir( dir ) - except OSError, e: + except OSError as e: # The directory is not empty. pass # See if any admin users have chosen to receive email alerts when a repository is updated. @@ -235,7 +235,7 @@ def handle_gzip( repository, uploaded_file_name ): while 1: try: chunk = gzipped_file.read( basic_util.CHUNK_SIZE ) - except IOError, e: + except IOError as e: os.close( fd ) os.remove( uncompressed ) log.exception( 'Problem uncompressing gz data "%s": %s' % ( uploaded_file_name, str( e ) ) ) diff --git a/lib/tool_shed/util/common_util.py b/lib/tool_shed/util/common_util.py index 2db00a001ea..ed6aad5c3d9 100644 --- a/lib/tool_shed/util/common_util.py +++ b/lib/tool_shed/util/common_util.py @@ -159,7 +159,7 @@ def get_repository_dependencies( app, tool_shed_url, repository_name, repository try: raw_text = util.url_get( tool_shed_url, password_mgr=app.tool_shed_registry.url_auth( tool_shed_url ), pathspec=pathspec, params=params ) tool_shed_accessible = True - except Exception, e: + except Exception as e: tool_shed_accessible = False log.warn( "The URL\n%s\nraised the exception:\n%s\n", util.build_url( tool_shed_url, pathspec=pathspec, params=params ), e ) if tool_shed_accessible: @@ -174,7 +174,7 @@ def get_protocol_from_tool_shed_url( tool_shed_url ): try: if tool_shed_url.find( '://' ) > 0: return tool_shed_url.split( '://' )[0].lower() - except Exception, e: + except Exception as e: # We receive a lot of calls here where the tool_shed_url is None. The container_util uses # that value when creating a header row. If the tool_shed_url is not None, we have a problem. if tool_shed_url is not None: @@ -191,7 +191,7 @@ def get_tool_dependencies( app, tool_shed_url, repository_name, repository_owner try: text = util.url_get( tool_shed_url, password_mgr=app.tool_shed_registry.url_auth( tool_shed_url ), pathspec=pathspec, params=params ) tool_shed_accessible = True - except Exception, e: + except Exception as e: tool_shed_accessible = False log.warn( "The URL\n%s\nraised the exception:\n%s\n", util.build_url( tool_shed_url, pathspec=pathspec, params=params ), e ) if tool_shed_accessible: @@ -260,7 +260,7 @@ def handle_tool_shed_url_protocol( app, shed_url ): else: tool_shed_url = str( url_for( '/', qualified=True ) ).rstrip( '/' ) return tool_shed_url - except Exception, e: + except Exception as e: # We receive a lot of calls here where the tool_shed_url is None. The container_util uses # that value when creating a header row. If the tool_shed_url is not None, we have a problem. if shed_url is not None: @@ -301,7 +301,7 @@ def remove_port_from_tool_shed_url( tool_shed_url ): else: new_tool_shed_url = tool_shed_url return new_tool_shed_url.rstrip( '/' ) - except Exception, e: + except Exception as e: # We receive a lot of calls here where the tool_shed_url is None. The container_util uses # that value when creating a header row. If the tool_shed_url is not None, we have a problem. if tool_shed_url is not None: diff --git a/lib/tool_shed/util/hg_util.py b/lib/tool_shed/util/hg_util.py index ba2277b42e5..3aab52994c2 100644 --- a/lib/tool_shed/util/hg_util.py +++ b/lib/tool_shed/util/hg_util.py @@ -31,7 +31,7 @@ def archive_repository_revision( app, repository, archive_dir, changeset_revisio return_code = None try: return_code = commands.archive( get_configured_ui, repo, archive_dir, **options_dict ) - except Exception, e: + except Exception as e: error_message = "Error attempting to archive revision %s of repository %s: %s\nReturn code: %s\n" % \ ( str( changeset_revision ), str( repository.name ), str( e ), str( return_code ) ) log.exception( error_message ) @@ -62,7 +62,7 @@ def clone_repository( repository_clone_url, repository_file_dir, ctx_rev ): noupdate=False, rev=listify( str( ctx_rev ) ) ) return True, None - except Exception, e: + except Exception as e: error_message = 'Error cloning repository: %s' % str( e ) log.debug( error_message ) return False, error_message diff --git a/lib/tool_shed/util/readme_util.py b/lib/tool_shed/util/readme_util.py index 82b919db440..61442e3c1ed 100644 --- a/lib/tool_shed/util/readme_util.py +++ b/lib/tool_shed/util/readme_util.py @@ -40,7 +40,7 @@ def build_readme_files_dict( app, repository, changeset_revision, metadata, tool f = open( full_path_to_readme_file, 'r' ) text = unicodify( f.read() ) f.close() - except Exception, e: + except Exception as e: log.exception( "Error reading README file '%s' from disk: %s" % ( str( relative_path_to_readme_file ), str( e ) ) ) text = None if text: @@ -53,7 +53,7 @@ def build_readme_files_dict( app, repository, changeset_revision, metadata, tool text_of_reasonable_length = suc.set_image_paths( app, app.security.encode_id( repository.id ), text_of_reasonable_length ) - except Exception, e: + except Exception as e: log.exception( "Exception in build_readme_files_dict, so images may not be properly displayed:\n%s" % str( e ) ) finally: lock.release() @@ -78,7 +78,7 @@ def build_readme_files_dict( app, repository, changeset_revision, metadata, tool try: text = unicodify( fctx.data() ) readme_files_dict[ readme_file_name ] = basic_util.size_string( text ) - except Exception, e: + except Exception as e: log.exception( "Error reading README file '%s' from repository manifest: %s" % ( str( relative_path_to_readme_file ), str( e ) ) ) return readme_files_dict diff --git a/lib/tool_shed/util/shed_util_common.py b/lib/tool_shed/util/shed_util_common.py index 8ebfe1f3254..1437d597f22 100644 --- a/lib/tool_shed/util/shed_util_common.py +++ b/lib/tool_shed/util/shed_util_common.py @@ -926,7 +926,7 @@ def get_tool_shed_status_for_installed_repository( app, repository ): encoded_tool_shed_status_dict = util.url_get( tool_shed_url, password_mgr=app.tool_shed_registry.url_auth( tool_shed_url ), pathspec=pathspec, params=params ) tool_shed_status_dict = encoding_util.tool_shed_decode( encoded_tool_shed_status_dict ) return tool_shed_status_dict - except HTTPError, e: + except HTTPError as e: # This should handle backward compatility to the Galaxy 12/20/12 release. We used to only handle updates for an installed revision # using a boolean value. log.debug( "Error attempting to get tool shed status for installed repository %s: %s\nAttempting older 'check_for_updates' method.\n" % @@ -937,10 +937,10 @@ def get_tool_shed_status_for_installed_repository( app, repository ): # The value of text will be 'true' or 'false', depending upon whether there is an update available for the installed revision. text = util.url_get( tool_shed_url, password_mgr=app.tool_shed_registry.url_auth( tool_shed_url ), pathspec=pathspec, params=params ) return dict( revision_update=text ) - except Exception, e: + except Exception as e: # The required tool shed may be unavailable, so default the revision_update value to 'false'. return dict( revision_update='false' ) - except Exception, e: + except Exception as e: log.exception( "Error attempting to get tool shed status for installed repository %s: %s" % ( str( repository.name ), str( e ) ) ) return {} @@ -1169,7 +1169,7 @@ def open_repository_files_folder( app, folder_path, repository_id, is_admin=Fals return [] try: files_list = get_repository_files( folder_path ) - except OSError, e: + except OSError as e: if str( e ).find( 'No such file or directory' ) >= 0: # We have a repository with no contents. return [] @@ -1308,7 +1308,7 @@ def set_repository_attributes( app, repository, status, error_message, deleted, try: shutil.rmtree( clone_dir ) log.debug( "Removed repository installation directory: %s" % str( clone_dir ) ) - except Exception, e: + except Exception as e: log.debug( "Error removing repository installation directory %s: %s" % ( str( clone_dir ), str( e ) ) ) repository.error_message = error_message repository.status = status diff --git a/lib/tool_shed/util/tool_dependency_util.py b/lib/tool_shed/util/tool_dependency_util.py index 50a77d9de0e..7cc796118c0 100644 --- a/lib/tool_shed/util/tool_dependency_util.py +++ b/lib/tool_shed/util/tool_dependency_util.py @@ -363,7 +363,7 @@ def remove_tool_dependency_installation_directory( dependency_install_dir ): removed = True error_message = '' log.debug( "Removed tool dependency installation directory: %s" % str( dependency_install_dir ) ) - except Exception, e: + except Exception as e: removed = False error_message = "Error removing tool dependency installation directory %s: %s" % ( str( dependency_install_dir ), str( e ) ) log.warn( error_message ) diff --git a/lib/tool_shed/util/tool_util.py b/lib/tool_shed/util/tool_util.py index af2ab8d70bd..67808f9c71f 100644 --- a/lib/tool_shed/util/tool_util.py +++ b/lib/tool_shed/util/tool_util.py @@ -241,7 +241,7 @@ def new_state( trans, tool, invalid=False ): try: # Attempt to generate the tool state using the standard Galaxy-side code return tool.new_state( trans ) - except Exception, e: + except Exception as e: # Fall back to building tool state as below log.debug( 'Failed to build tool state for tool "%s" using standard method, will try to fall back on custom method: %s', tool.id, e ) inputs = tool.inputs_by_page[ 0 ] diff --git a/lib/tool_shed/util/xml_util.py b/lib/tool_shed/util/xml_util.py index 8e679ab89b6..0e1e789adfc 100644 --- a/lib/tool_shed/util/xml_util.py +++ b/lib/tool_shed/util/xml_util.py @@ -122,7 +122,7 @@ def parse_xml( file_name ): if using_python_27: try: tree = XmlET.parse( fobj, parser=XmlET.XMLParser( target=Py27CommentedTreeBuilder() ) ) - except Exception, e: + except Exception as e: fobj.close() error_message = "Exception attempting to parse %s: %s" % ( str( file_name ), str( e ) ) log.exception( error_message ) @@ -130,7 +130,7 @@ def parse_xml( file_name ): else: try: tree = XmlET.parse( fobj, parser=Py26CommentedTreeBuilder() ) - except Exception, e: + except Exception as e: fobj.close() error_message = "Exception attempting to parse %s: %s" % ( str( file_name ), str( e ) ) log.exception( error_message ) diff --git a/lib/tool_shed/utility_containers/__init__.py b/lib/tool_shed/utility_containers/__init__.py index 2023a70ac86..d467f7d1d2a 100644 --- a/lib/tool_shed/utility_containers/__init__.py +++ b/lib/tool_shed/utility_containers/__init__.py @@ -202,7 +202,7 @@ class ToolShedUtilityContainerManager( utility_container_manager.UtilityContaine type = requirements_dict[ 'type' ] version = requirements_dict[ 'version' ] error = requirements_dict[ 'error' ] - except Exception, e: + except Exception as e: name = 'unknown' type = 'unknown' version = 'unknown' @@ -350,7 +350,7 @@ class ToolShedUtilityContainerManager( utility_container_manager.UtilityContaine error_messages, label="Invalid Data Managers" ) containers_dict[ 'invalid_data_managers' ] = data_managers_root_folder - except Exception, e: + except Exception as e: log.exception( "Exception in build_repository_containers: %s" % str( e ) ) finally: lock.release() diff --git a/lib/tool_shed/utility_containers/utility_container_manager.py b/lib/tool_shed/utility_containers/utility_container_manager.py index 224c5310ae4..d7427139df3 100644 --- a/lib/tool_shed/utility_containers/utility_container_manager.py +++ b/lib/tool_shed/utility_containers/utility_container_manager.py @@ -218,7 +218,7 @@ class UtilityContainerManager( object ): name = data_manager_dict.get( 'name', '' ) version = data_manager_dict.get( 'version', '' ) data_tables = ", ".join( data_manager_dict.get( 'data_tables', '' ) ) - except Exception, e: + except Exception as e: name = str( e ) version = 'unknown' data_tables = 'unknown' @@ -277,7 +277,7 @@ class UtilityContainerManager( object ): subclass = datatypes_dict.get( 'subclass', '' ) converters = num_converters display_app_containers = num_display_app_containers - except Exception, e: + except Exception as e: extension = str( e ) type = 'unknown' mimetype = 'unknown' @@ -466,7 +466,7 @@ class UtilityContainerManager( object ): try: requirement_name = str( requirement_dict.get( 'name', 'unknown' ) ) requirement_type = str( requirement_dict.get( 'type', 'unknown' ) ) - except Exception, e: + except Exception as e: requirement_name = str( e ) requirement_type = 'unknown' requirements_str += '%s (%s), ' % ( requirement_name, requirement_type ) @@ -479,7 +479,7 @@ class UtilityContainerManager( object ): name = str( tool_dict.get( 'name', 'unknown' ) ) description = str( tool_dict.get( 'description', '' ) ) version = str( tool_dict.get( 'version', 'unknown' ) ) - except Exception, e: + except Exception as e: tool_config = str( e ) tool_id = 'unknown' name = 'unknown' @@ -552,7 +552,7 @@ class UtilityContainerManager( object ): type = set_environment_dict[ 'type' ] repository_id = set_environment_dict.get( 'repository_id', None ) td_id = set_environment_dict.get( 'tool_dependency_id', None ) - except Exception, e: + except Exception as e: name = str( e ) type = 'unknown' repository_id = 'unknown' @@ -560,7 +560,7 @@ class UtilityContainerManager( object ): if self.app.name == 'galaxy': try: installation_status = set_environment_dict.get( 'status', 'Never installed' ) - except Exception, e: + except Exception as e: installation_status = str( e ) else: installation_status = None @@ -580,7 +580,7 @@ class UtilityContainerManager( object ): type = requirements_dict[ 'type' ] repository_id = requirements_dict.get( 'repository_id', None ) td_id = requirements_dict.get( 'tool_dependency_id', None ) - except Exception, e: + except Exception as e: name = str( e ) version = 'unknown' type = 'unknown' @@ -589,7 +589,7 @@ class UtilityContainerManager( object ): if self.app.name == 'galaxy': try: installation_status = requirements_dict.get( 'status', 'Never installed' ) - except Exception, e: + except Exception as e: installation_status = str( e ) else: installation_status = None