Fix dict.keys() PY3 compatible

The dict.keys()[0] will raise a TypeError in PY3,
as dict.keys() doesn't return a list any more in PY3
but a view of list.

Change-Id: If15a153c9db9b654e761f8ad50d5d66a427efa4e
Closes-Bug: #1583419
This commit is contained in:
weiweigu
2016-07-14 13:45:47 +08:00
parent 8635beb045
commit cd60336e20

View File

@@ -64,7 +64,7 @@ class ContinuousAuditHandler(base.AuditHandler):
# if audit isn't in active states, audit's job must be removed to
# prevent using of inactive audit in future.
job_to_delete = [job for job in self.jobs
if job.keys()[0] == audit.uuid][0]
if list(job.keys())[0] == audit.uuid][0]
self.jobs.remove(job_to_delete)
job_to_delete[audit.uuid].remove()