From 25398bf8187b81f4620ebe6dccf71fbfbea9ee0e Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Wed, 21 Jun 2023 16:42:02 +0100 Subject: [PATCH] Fix converting Enum value to str for Python 3.11 Fix the following traceback: ``` Traceback (most recent call last): File "/tmp/tmpiustglxt/galaxy-dev/lib/galaxy/util/dictifiable.py", line 57, in to_dict visible_keys = self.__getattribute__(f"dict_{view}_visible_keys") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'WorkflowInvocation' object has no attribute 'dict_InvocationSerializationView.element_visible_keys' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/tmp/tmpiustglxt/galaxy-dev/lib/galaxy/web/framework/decorators.py", line 337, in decorator rval = func(self, trans, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmpiustglxt/galaxy-dev/lib/galaxy/webapps/galaxy/api/workflows.py", line 891, in show_invocation return self.__encode_invocation(workflow_invocation, **kwd) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmpiustglxt/galaxy-dev/lib/galaxy/webapps/galaxy/api/workflows.py", line 1108, in __encode_invocation return self.invocations_service.serialize_workflow_invocation(invocation, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmpiustglxt/galaxy-dev/lib/galaxy/webapps/galaxy/services/invocations.py", line 202, in serialize_workflow_invocation as_dict = invocation.to_dict(view, step_details=step_details, legacy_job_state=legacy_job_state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmpiustglxt/galaxy-dev/lib/galaxy/model/__init__.py", line 7814, in to_dict rval = super().to_dict(view=view, value_mapper=value_mapper) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/tmpiustglxt/galaxy-dev/lib/galaxy/util/dictifiable.py", line 59, in to_dict raise Exception(f"Unknown Dictifiable view: {view}") Exception: Unknown Dictifiable view: InvocationSerializationView.element ``` Broken in https://github.com/galaxyproject/galaxy/pull/13875 . --- lib/galaxy/webapps/galaxy/services/invocations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/webapps/galaxy/services/invocations.py b/lib/galaxy/webapps/galaxy/services/invocations.py index 9c6130b00853..734e689d676d 100644 --- a/lib/galaxy/webapps/galaxy/services/invocations.py +++ b/lib/galaxy/webapps/galaxy/services/invocations.py @@ -199,7 +199,7 @@ def serialize_workflow_invocation( view = params.view or default_view step_details = params.step_details legacy_job_state = params.legacy_job_state - as_dict = invocation.to_dict(view, step_details=step_details, legacy_job_state=legacy_job_state) + as_dict = invocation.to_dict(view.value, step_details=step_details, legacy_job_state=legacy_job_state) as_dict = self.security.encode_all_ids(as_dict, recursive=True) as_dict["messages"] = [ InvocationMessageResponseModel.parse_obj(message).__root__.dict() for message in invocation.messages