This copies the same regex that parse uses to find the name. Perhaps future
work should abstract this into a common method.

Signed-off-by: Sean Farley <s...@farley.io>
---
 patchwork/models.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/patchwork/models.py b/patchwork/models.py
index e1350c2..03109d3 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -619,7 +619,11 @@ class Series(FilenameMixin, models.Model):
 
     @staticmethod
     def _format_name(obj):
-        return obj.name.split(']')[-1].strip()
+        prefix_re = re.compile(r'^\[([^\]]*)\]\s*(.*)$')
+        match = prefix_re.match(obj.name)
+        if match:
+            return match.group(2)
+        return obj.name.strip()
 
     @property
     def received_total(self):
-- 
2.13.2

_______________________________________________
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork

Reply via email to