Message ID | 20170711184139.94122-3-sean@farley.io |
---|---|
State | Accepted |
Headers | show |
On Tue, 2017-07-11 at 11:41 -0700, Sean Farley wrote: > 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@farley.io> We actually do this already as part of the parser code [1]. However, it's no harm to have this here so I've included this with the previous patch. Reviewed-by: Stephen Finucane <stephen@that.guru> [1] https://github.com/getpatchwork/patchwork/blob/18a2b98a/patchwork/parser.py #L647
Stephen Finucane <stephen@that.guru> writes: > On Tue, 2017-07-11 at 11:41 -0700, Sean Farley wrote: >> 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@farley.io> > > We actually do this already as part of the parser code [1]. However, it's no > harm to have this here so I've included this with the previous patch. Ah, I see. I think I use this in a future patch not yet submitted but I'll have to dig that up (and probably wait until after the release).
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.
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@farley.io> --- patchwork/models.py | 2 +- patchwork/tests/test_series.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)