update db if guest was reclassified as robot

This commit is contained in:
j 2016-08-31 17:38:40 +02:00
parent 680efc967c
commit 3913373c9b
2 changed files with 4 additions and 2 deletions

View file

@ -37,7 +37,6 @@ def parseCondition(condition, user):
else: else:
key = k + get_operator(op, 'istr') key = k + get_operator(op, 'istr')
key = str(key) key = str(key)
q = Q(**{key: v}) q = Q(**{key: v})
if exclude: if exclude:
q = ~q q = ~q
@ -53,7 +52,7 @@ def parseConditions(conditions, operator, user):
for condition in conditions: for condition in conditions:
if 'conditions' in condition: if 'conditions' in condition:
q = parseConditions(condition['conditions'], q = parseConditions(condition['conditions'],
condition.get('operator', '&'), user) condition.get('operator', '&'), user)
if q: if q:
conn.append(q) conn.append(q)
pass pass

View file

@ -141,6 +141,9 @@ class SessionData(models.Model):
def json(self, keys=None, user=None): def json(self, keys=None, user=None):
ua = ox.parse_useragent(self.useragent or '') ua = ox.parse_useragent(self.useragent or '')
if ua['robot']['name'] and self.level != -1:
self.level = -1
self.save()
j = { j = {
'browser': ua['browser']['string'], 'browser': ua['browser']['string'],
'disabled': False, 'disabled': False,