Skip to content

Commit 2902c17

Browse files
committed
Fixup
1 parent 3dee7a9 commit 2902c17

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

temporalio/nexus/_operation_context.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,13 @@ def _workflow_handle_to_workflow_execution_started_event_link(
499499
)
500500

501501

502+
_LINK_URL_PATH_REGEX = re.compile(
503+
r"^/namespaces/(?P<namespace>[^/]+)/workflows/(?P<workflow_id>[^/]+)/(?P<run_id>[^/]+)/history$"
504+
)
505+
LINK_EVENT_ID_PARAM_NAME = "eventID"
506+
LINK_EVENT_TYPE_PARAM_NAME = "eventType"
507+
508+
502509
def _workflow_event_to_nexus_link(
503510
workflow_event: temporalio.api.common.v1.Link.WorkflowEvent,
504511
) -> nexusrpc.Link:
@@ -521,13 +528,6 @@ def _workflow_event_to_nexus_link(
521528
)
522529

523530

524-
_LINK_URL_PATH_REGEX = re.compile(
525-
r"^/namespaces/(?P<namespace>[^/]+)/workflows/(?P<workflow_id>[^/]+)/(?P<run_id>[^/]+)/history$"
526-
)
527-
LINK_EVENT_ID_PARAM_NAME = "eventID"
528-
LINK_EVENT_TYPE_PARAM_NAME = "eventType"
529-
530-
531531
def _nexus_link_to_workflow_event(
532532
link: nexusrpc.Link,
533533
) -> Optional[temporalio.api.common.v1.Link.WorkflowEvent]:
@@ -539,7 +539,7 @@ def _nexus_link_to_workflow_event(
539539
)
540540
return None
541541
try:
542-
event_ref = _event_reference_from_query_params(urllib.parse.parse_qs(url.query))
542+
event_ref = _event_reference_from_query_params(url.query)
543543
except ValueError as err:
544544
logger.warning(
545545
f"Failed to parse event reference from Nexus link URL query parameters: {link} ({err})"
@@ -556,11 +556,13 @@ def _nexus_link_to_workflow_event(
556556

557557

558558
def _event_reference_from_query_params(
559-
query_params: Mapping[str, list[str]],
559+
raw_query_params: str,
560560
) -> temporalio.api.common.v1.Link.WorkflowEvent.EventReference:
561561
"""
562562
Return an EventReference from the query params or raise ValueError.
563563
"""
564+
query_params = urllib.parse.parse_qs(raw_query_params)
565+
564566
[reference_type] = query_params.get("referenceType") or [None]
565567
if reference_type != "EventReference":
566568
raise ValueError(

0 commit comments

Comments
 (0)