You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by ke...@apache.org on 2021/12/07 16:07:24 UTC

[allura] 01/01: Adds method to fetch multiple troves by their IDs

This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a commit to branch kt/trovecat_fetch_many
in repository https://gitbox.apache.org/repos/asf/allura.git

commit ec83d00dd09d6031db1fb898f75d1cc76fceca0c
Author: Kenton Taylor <kt...@slashdotmedia.com>
AuthorDate: Tue Dec 7 16:06:34 2021 +0000

    Adds method to fetch multiple troves by their IDs
---
 Allura/allura/model/project.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 1ef6973..1c2afe3 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -175,6 +175,10 @@ class TroveCategory(MappedClass):
         'remove first section of full path, and use nicer separator'
         return ' ยป '.join(self.fullpath.split(' :: ')[1:])
 
+    @classmethod
+    def by_trove_cat_ids(cls, *ids):
+        return cls.query.find({'trove_cat_id': {'$in': ids}}).all()
+
     def __json__(self):
         return dict(
             id=self.trove_cat_id,