Tweak status code rendering for upgrades API view

This commit is contained in:
Lance Edgar 2018-11-02 21:43:56 -05:00
parent 22ef6aad7b
commit 31ae5eacd5

View file

@ -38,15 +38,19 @@ class UpgradeView(APIMasterView):
model_class = model.Upgrade model_class = model.Upgrade
def normalize(self, upgrade): def normalize(self, upgrade):
return { data = {
'created': upgrade.created.isoformat(), 'created': upgrade.created.isoformat(),
'description': upgrade.description, 'description': upgrade.description,
'enabled': upgrade.enabled, 'enabled': upgrade.enabled,
'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': upgrade.executed.isoformat() if upgrade.executed else None,
# 'executed_by': # 'executed_by':
} }
if upgrade.status_code is None:
data['status_code'] = None
else:
data['status_code'] = self.enum.UPGRADE_STATUS.get(upgrade.status_code,
six.text_type(upgrade.status_code))
return data
def includeme(config): def includeme(config):