[PATCH 3/5] models: strip result of _format_name
Sean Farley
sean at farley.io
Wed Jul 12 04:41:37 AEST 2017
It doesn't seem we would want names of a patch or series to start or end with a
space, so let's strip that off.
Signed-off-by: Sean Farley <sean at farley.io>
---
patchwork/models.py | 2 +-
patchwork/tests/test_series.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/patchwork/models.py b/patchwork/models.py
index df5c6fe..4ac7a1f 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -626,7 +626,7 @@ class Series(FilenameMixin, models.Model):
return self.total <= self.received_total
def _format_name(self, obj):
- return obj.name.split(']')[-1]
+ return obj.name.split(']')[-1].strip()
def add_cover_letter(self, cover):
"""Add a cover letter to the series.
diff --git a/patchwork/tests/test_series.py b/patchwork/tests/test_series.py
index e26dd3e..6ebfae1 100644
--- a/patchwork/tests/test_series.py
+++ b/patchwork/tests/test_series.py
@@ -639,7 +639,7 @@ class SeriesNameTestCase(TestCase):
@staticmethod
def _format_name(cover):
- return cover.name.split(']')[-1]
+ return cover.name.split(']')[-1].strip()
def test_cover_letter(self):
"""Cover letter name set as series name.
--
2.13.2
More information about the Patchwork
mailing list