Commit f9e47f65 authored by ale's avatar ale

support awfully-encoded old entries

parent 0deeafb9
......@@ -60,7 +60,7 @@ def submit(results, submit_url):
# the first connection if it's a POST).
opener = create_opener()
result =
except Exception, e:
log.error('submit(ping) error: %s', e)
......@@ -27,6 +27,14 @@ def get_redis_connection():
def _compat_json_loads(s):
# Awful trick for backwards compatibility with very very old,
# incorrectly-encoded entries.
if s.startswith("{'"):
s = s.replace("'", '"')
return json.loads(s)
# Retrieve all per-user data and cache it somewhere (for a short time,
# since FastCGI runners aren't long-lived anyway).
......@@ -36,7 +44,7 @@ def get_virus_by_user():
for obj in ai.LDAPObj(ai.config.base_uid).search('(&(objectClass=ftpAccount)(status=active))'):
entries = rdb.lrange('virus:%s' % obj['ftpname'], 0, -1)
if entries:
virus_by_user[obj['ftpname']] = [json.loads(x) for x in entries]
virus_by_user[obj['ftpname']] = [_compat_json_loads(x) for x in entries]
return virus_by_user
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment