From 0202ad2036d631496fc3d86dff33b97d412828c6 Mon Sep 17 00:00:00 2001 From: Andre D Date: Fri, 28 Jun 2013 12:39:49 -0700 Subject: [PATCH] modaction: Allow querying by multiple moderators. --- r2/r2/models/modaction.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/r2/r2/models/modaction.py b/r2/r2/models/modaction.py index 1c2e932f3..46f1e4009 100644 --- a/r2/r2/models/modaction.py +++ b/r2/r2/models/modaction.py @@ -21,6 +21,7 @@ ############################################################################### from datetime import timedelta +import itertools from r2.lib.db import tdb_cassandra from r2.lib.utils import tup @@ -247,7 +248,10 @@ class ModAction(tdb_cassandra.UuidThing, Printable): rowkeys = [sr._id36 for sr in srs] q = ModActionBySR.query(rowkeys, after=after, reverse=reverse, count=count) elif mod and not action: - rowkeys = ['%s_%s' % (sr._id36, mod._id36) for sr in srs] + mods = tup(mod) + rowkeys = itertools.product([sr._id36 for sr in srs], + [mod._id36 for mod in mods]) + rowkeys = ['%s_%s' % (sr, mod) for sr, mod in rowkeys] q = ModActionBySRMod.query(rowkeys, after=after, reverse=reverse, count=count) elif not mod and action: rowkeys = ['%s_%s' % (sr._id36, action) for sr in srs]