You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/12/20 20:17:29 UTC

[2/3] git commit: [#6388] avoid empty trove queries

[#6388] avoid empty trove queries


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/62d57d2f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/62d57d2f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/62d57d2f

Branch: refs/heads/db/6388
Commit: 62d57d2f8dd646d4fb2f1ee00b4f25173349a57b
Parents: 95f0b1d
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Fri Dec 20 19:03:12 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Dec 20 19:03:12 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/project.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/62d57d2f/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index d8584ef..b720343 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -257,7 +257,11 @@ class Project(MappedClass, ActivityNode, ActivityObject):
         return result
 
     def troves_by_type(self, trove_type):
-        return TroveCategory.query.find({'_id':{'$in':getattr(self,'trove_%s' % trove_type)}}).all()
+        troves = getattr(self, 'trove_%s' % trove_type)
+        if troves:
+            return TroveCategory.query.find({'_id':{'$in': troves}}).all()
+        else:
+            return []
 
     def all_troves(self):
         '''