From 3913373c9b80e511b665ffb6e722b765a8fffaf7 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 31 Aug 2016 17:38:40 +0200 Subject: [PATCH] update db if guest was reclassified as robot --- pandora/user/managers.py | 3 +-- pandora/user/models.py | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pandora/user/managers.py b/pandora/user/managers.py index d23007e57..3e7b9caec 100644 --- a/pandora/user/managers.py +++ b/pandora/user/managers.py @@ -37,7 +37,6 @@ def parseCondition(condition, user): else: key = k + get_operator(op, 'istr') key = str(key) - q = Q(**{key: v}) if exclude: q = ~q @@ -53,7 +52,7 @@ def parseConditions(conditions, operator, user): for condition in conditions: if 'conditions' in condition: q = parseConditions(condition['conditions'], - condition.get('operator', '&'), user) + condition.get('operator', '&'), user) if q: conn.append(q) pass diff --git a/pandora/user/models.py b/pandora/user/models.py index e810230e7..3e3595af1 100644 --- a/pandora/user/models.py +++ b/pandora/user/models.py @@ -141,6 +141,9 @@ class SessionData(models.Model): def json(self, keys=None, user=None): ua = ox.parse_useragent(self.useragent or '') + if ua['robot']['name'] and self.level != -1: + self.level = -1 + self.save() j = { 'browser': ua['browser']['string'], 'disabled': False,