From e2436aa7c3fc61846c5b3797de24a6844dc1e422 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 3 Oct 2011 13:29:10 +0200 Subject: [PATCH] find in layer --- pandora/clip/managers.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pandora/clip/managers.py b/pandora/clip/managers.py index ae109266..e2cf2b06 100644 --- a/pandora/clip/managers.py +++ b/pandora/clip/managers.py @@ -33,6 +33,17 @@ def parseCondition(condition, user): op = condition.get('operator') if not op: op = '' + public_layers = [l['id'] + for l in filter(lambda l: not l.get('private', False), + settings.CONFIG['layers'])] + if k in public_layers: + return parseCondition({'key': 'annotations__value', + 'value': v, + 'operator': op}, user) \ + & parseCondition({'key': 'annotations__layer__name', + 'value': k, + 'operator': '=='}, user) + if op.startswith('!'): op = op[1:] exclude = True