Skip to content

Commit 280e715

Browse files
committed
feat: import handlers if not already imported
Signed-off-by: Colton Wolkins (Laptop) <[email protected]>
1 parent a4748ea commit 280e715

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

acapy_agent/core/dispatcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ async def make_v2_message(self, profile: Profile, parsed_msg: dict) -> BaseMessa
256256
#instance = message_cls[0] #message_cls.deserialize(parsed_msg)
257257
instance = registry.handlers[message_cls[0]]
258258
if isinstance(instance, DeferLoad):
259-
instance = message_cls.resolved
259+
instance = instance.resolved
260260
except BaseModelError as e:
261261
if "/problem-report" in message_type:
262262
raise ProblemReportParseError("Error parsing problem report message")

acapy_agent/didcomm_v2/protocol_registry.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Registry for DIDComm V2 Protocols."""
22

3-
from typing import Coroutine, Dict, Sequence
3+
from ..utils.classloader import DeferLoad
4+
from typing import Coroutine, Dict, Sequence, Union
45

56

67
class V2ProtocolRegistry:
@@ -35,6 +36,8 @@ def protocols_matching_query(self, query: str) -> Sequence[str]:
3536
result = (query,)
3637
return result or ()
3738

38-
def register_handler(self, message_type: str, handler: Coroutine):
39+
def register_handler(self, message_type: str, handler: Union[Coroutine, str]):
3940
"""Register a new message type to handler association."""
41+
if isinstance(handler, str):
42+
handler = DeferLoad(handler)
4043
self._type_to_message_handler[message_type] = handler

0 commit comments

Comments
 (0)