You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2014/01/02 17:17:07 UTC

[17/17] 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/35ed1c39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/35ed1c39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/35ed1c39

Branch: refs/heads/master
Commit: 35ed1c39ed49f9225071263db578e1562c292a2d
Parents: 15225cd
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Fri Dec 20 19:03:12 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 2 16:16:21 2014 +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/35ed1c39/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):
         '''