From 9ebd2cba32e5badafe1678c6ddad9816024f16b3 Mon Sep 17 00:00:00 2001 From: Dillon Walls Date: Wed, 13 Mar 2024 19:38:02 +0000 Subject: [PATCH] [#8538] add new get_object_from_id timeline helper method which tries to find an object from an allura_id --- Allura/allura/model/timeline.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Allura/allura/model/timeline.py b/Allura/allura/model/timeline.py index 9048b6c1e..6c343bd6f 100644 --- a/Allura/allura/model/timeline.py +++ b/Allura/allura/model/timeline.py @@ -138,7 +138,11 @@ def get_activity_object(activity_object_dict): allura_id = get_allura_id(activity_object_dict) if not allura_id: return None - classname, _id = allura_id.split(':', 1) + return get_object_from_id(allura_id) + + +def get_object_from_id(node_id): + classname, _id = node_id.split(':', 1) cls = Mapper.by_classname(classname).mapped_class try: _id = bson.ObjectId(_id)