Commit 21f8e2e4 authored by Arkadiusz Hiler's avatar Arkadiusz Hiler
Browse files

models/series: Be more defensive with human_name



Sometimes series revision ends up in odd, incomplete state and we lose
the 'last_revision' association.

Be more defensive when deciding on the human_name and call out
incomplete series.
Signed-off-by: default avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
parent ba064623
......@@ -558,11 +558,14 @@ class Series(models.Model):
return filename(self.name, '.mbox')
def human_name(self):
name = self.name
if name == SERIES_DEFAULT_NAME:
name = "series starting with " + \
self.last_revision.ordered_patches()[0].name
return name
if self.name == SERIES_DEFAULT_NAME:
if self.last_revision:
ordered_patches = self.last_revision.ordered_patches()
if ordered_patches:
return "series starting with " + ordered_patches[0].name
return "Incomplete Series"
else:
return self.name
def __str__(self):
return self.name
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment