From 62b56f7d0c300d0c159bc595f3e3741c3c28c7d7 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Wed, 22 Jul 2015 18:26:23 +0100 Subject: [PATCH] Treat findEdits({}) like findEdits({query: {}}) This is consistent with the other find* methods --- pandora/edit/managers.py | 5 +++-- pandora/edit/views.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pandora/edit/managers.py b/pandora/edit/managers.py index d5d2635..8727f59 100644 --- a/pandora/edit/managers.py +++ b/pandora/edit/managers.py @@ -120,8 +120,9 @@ class EditManager(Manager): #join query with operator qs = self.get_query_set() - conditions = parseConditions(data['query'].get('conditions', []), - data['query'].get('operator', '&'), + query = data.get('query', {}) + conditions = parseConditions(query.get('conditions', []), + query.get('operator', '&'), user) if conditions: qs = qs.filter(conditions) diff --git a/pandora/edit/views.py b/pandora/edit/views.py index 46cb89a..6e49f7e 100644 --- a/pandora/edit/views.py +++ b/pandora/edit/views.py @@ -396,7 +396,8 @@ def findEdits(request, data): return x['key'] == 'status' and \ x['value'] == 'featured' and \ x['operator'] in ('=', '==') - is_featured = len(filter(is_featured_condition, data['query'].get('conditions', []))) > 0 + + is_featured = len(filter(is_featured_condition, data.get('query', {}).get('conditions', []))) > 0 if is_section_request: qs = query['qs'] -- 2.4.3