From 22ef6aad7b8f6c635f1758c074e7a06bc4888a9d Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 2 Nov 2018 21:38:06 -0500 Subject: [PATCH] Fix bug in upgrades API view, when upgrade has no status code --- tailbone/api/upgrades.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tailbone/api/upgrades.py b/tailbone/api/upgrades.py index 34415002..28bea59c 100644 --- a/tailbone/api/upgrades.py +++ b/tailbone/api/upgrades.py @@ -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': }