Skip to content

Commit

Permalink
Ensure job_data["content"] is not None
Browse files Browse the repository at this point in the history
  • Loading branch information
Matir committed Aug 7, 2018
1 parent 6952153 commit 0b7da38
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Scorebot3/scorebot_grid/models.py
Expand Up @@ -261,8 +261,8 @@ def score_job(self, job, job_data):
else:
for job_service in job_data['services']:
try:
if service.port == int(job_service['port']) and \
service.get_protocol_display().lower() == job_service['protocol'].lower():
if (service.port == int(job_service['port']) and
service.get_protocol_display().lower() == job_service['protocol'].lower()):
service.score_job(job, job_service)
break
except ValueError:
Expand Down Expand Up @@ -364,7 +364,7 @@ def score_job(self, job, job_data):
api_debug('SCORING', 'Service "%s" was set "%s" by Job "%d".'
% (self.get_canonical_name(), self.get_status_display(), job.id))
if 'content' in job_data and self.content is not None:
if 'status' in job_data['content']:
if job_data['content'] is not None and 'status' in job_data['content']:
try:
self.content.status = int(job_data['content']['status'])
api_debug('SCORING', 'Service Content for "%s" was set to "%d" by Job "%d".' %
Expand Down

0 comments on commit 0b7da38

Please sign in to comment.