Commit e6f4ef1d authored by Rémi Duraffort's avatar Rémi Duraffort
Browse files

Use isinstance() instead of type()

parent 4440cd74
......@@ -198,7 +198,7 @@ class LavaTable(tables.Table):
:param data: the view data
:return: a list of exclusive terms
"""
if not hasattr(data, "discrete") or type(data.discrete) != list:
if not hasattr(data, "discrete") or not isinstance(data.discrete, list):
return {}
if self.prefix:
return {self.prefix: data.discrete} if len(data.discrete) > 1 else {}
......
......@@ -126,7 +126,7 @@ class SchedulerAPI(ExposedAPI):
raise xmlrpc.client.Fault(404, "Specified device or device type not found.")
except DevicesUnavailableException as exc:
raise xmlrpc.client.Fault(400, "Device unavailable: %s" % str(exc))
if isinstance(job, type(list())):
if isinstance(job, list):
return [j.sub_id for j in job]
else:
return job.id
......
......@@ -1093,7 +1093,7 @@ def job_submit(request):
definition_data = request.POST.get("definition-input")
job = testjob_submission(definition_data, request.user)
if isinstance(job, type(list())):
if isinstance(job, list):
response_data["job_list"] = [j.sub_id for j in job]
# Refer to first job in list for job info.
job = job[0]
......@@ -1643,7 +1643,7 @@ def job_resubmit(request, pk):
original = job
job = testjob_submission(request.POST.get("definition-input"),
request.user, original_job=original)
if isinstance(job, type(list())):
if isinstance(job, list):
response_data["job_list"] = [j.sub_id for j in job]
# Refer to first job in list for job info.
job = job[0]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment