Another fix for Python 2.6 (bug introduced with ff7be9d0eb)

This commit is contained in:
Miroslav Stampar 2015-09-24 16:26:52 +02:00
parent ea4cef9c6d
commit d28c72b6f1

View File

@ -376,15 +376,12 @@ def task_list(taskid=None):
"""
List task pull
"""
if is_admin(taskid):
tasks = list(DataStore.tasks)
else:
tasks = []
tasks = {}
for key in DataStore.tasks:
if DataStore.tasks[key].remote_addr == request.remote_addr:
tasks.append(key)
tasks = {x: dejsonize(scan_status(x))['status']
for x in list(DataStore.tasks)}
if is_admin(taskid) or DataStore.tasks[key].remote_addr == request.remote_addr:
tasks[key] = dejsonize(scan_status(key))["status"]
logger.debug("[%s] Listed task pool (%s)" % (taskid, "admin" if is_admin(taskid) else request.remote_addr))
return jsonize({"success": True, "tasks": tasks, "tasks_num": len(tasks)})