Fix bug in upgrades API view, when upgrade has no status code

This commit is contained in:
Lance Edgar 2018-11-02 21:38:06 -05:00
parent e4a518c444
commit 22ef6aad7b

View file

@ -26,6 +26,8 @@ Tailbone Web API - Upgrade Views
from __future__ import unicode_literals, absolute_import
import six
from rattail.db import model
from tailbone.api import APIMasterView
@ -40,8 +42,8 @@ class UpgradeView(APIMasterView):
'created': upgrade.created.isoformat(),
'description': upgrade.description,
'enabled': upgrade.enabled,
# 'status_code': upgrade.status_code,
'status_code': self.enum.UPGRADE_STATUS[upgrade.status_code],
'status_code': self.enum.UPGRADE_STATUS.get(upgrade.status_code,
six.text_type(upgrade.status_code)),
'executed': upgrade.executed.isoformat() if upgrade.executed else None,
# 'executed_by':
}