Skip to content

Commit

Permalink
[#8538] add new get_object_from_id timeline helper method which tries…
Browse files Browse the repository at this point in the history
… to find an object from an allura_id
  • Loading branch information
dill0wn authored and brondsem committed Mar 21, 2024
1 parent d3c5f4b commit 9ebd2cb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Allura/allura/model/timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9ebd2cb

Please sign in to comment.