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 List task pull
""" """
if is_admin(taskid): tasks = {}
tasks = list(DataStore.tasks)
else: for key in DataStore.tasks:
tasks = [] if is_admin(taskid) or DataStore.tasks[key].remote_addr == request.remote_addr:
for key in DataStore.tasks: tasks[key] = dejsonize(scan_status(key))["status"]
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)}
logger.debug("[%s] Listed task pool (%s)" % (taskid, "admin" if is_admin(taskid) else request.remote_addr)) 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)}) return jsonize({"success": True, "tasks": tasks, "tasks_num": len(tasks)})