Excuse: get source from MigrationItem

ubuntu/rebased
Ivo De Decker 5 years ago
parent 055f0f07e5
commit 5c7300caf0

@ -195,6 +195,10 @@ class Excuse(object):
def name(self): def name(self):
return self.item.name return self.item.name
@property
def source(self):
return self.item.package
@property @property
def is_valid(self): def is_valid(self):
return False if self._policy_verdict.is_rejected else True return False if self._policy_verdict.is_rejected else True
@ -433,17 +437,10 @@ class Excuse(object):
def excusedata(self): def excusedata(self):
"""Render the excuse in as key-value data""" """Render the excuse in as key-value data"""
source = self.name
if '_' in source:
source = source.split("_")[0]
if '/' in source:
source = source.split("/")[0]
if source[0] == '-':
source = source[1:]
excusedata = {} excusedata = {}
excusedata["excuses"] = self._text() excusedata["excuses"] = self._text()
excusedata["item-name"] = self.name excusedata["item-name"] = self.name
excusedata["source"] = source excusedata["source"] = self.source
excusedata["migration-policy-verdict"] = self._policy_verdict.name excusedata["migration-policy-verdict"] = self._policy_verdict.name
excusedata["old-version"] = self.ver[0] excusedata["old-version"] = self.ver[0]
excusedata["new-version"] = self.ver[1] excusedata["new-version"] = self.ver[1]

Loading…
Cancel
Save