aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Axtens <dja@axtens.net>2018-01-25 12:25:25 +1100
committerDaniel Axtens <dja@axtens.net>2018-01-31 02:28:14 +1100
commit6fe884f1d8711314708f4adc0b41c6ad64377161 (patch)
treedce98920425acec3ee5bbde44efd39c5a1b80253
parent3f46c99a403d1ec2cc86d67c7c88c61e5584403b (diff)
downloadpatchwork-6fe884f1d8711314708f4adc0b41c6ad64377161.tar
patchwork-6fe884f1d8711314708f4adc0b41c6ad64377161.tar.gz
tags: be a bit more permissive in what we render to a message
Currently we render a tag from a comment into a message if it is '^(whatever)-by: .*' We found a patch that had a UTF-8 non-breaking space after the colon, and this was breaking the regex. So just remove the requirement for a space entirely. Closes: #124 Signed-off-by: Daniel Axtens <dja@axtens.net>
-rw-r--r--patchwork/models.py2
-rw-r--r--patchwork/tests/test_mboxviews.py28
2 files changed, 21 insertions, 9 deletions
diff --git a/patchwork/models.py b/patchwork/models.py
index 11886f1..3bf7c72 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -317,7 +317,7 @@ class EmailMixin(models.Model):
content = models.TextField(null=True, blank=True)
response_re = re.compile(
- r'^(Tested|Reviewed|Acked|Signed-off|Nacked|Reported)-by: .*$',
+ r'^(Tested|Reviewed|Acked|Signed-off|Nacked|Reported)-by:.*$',
re.M | re.I)
@property
diff --git a/patchwork/tests/test_mboxviews.py b/patchwork/tests/test_mboxviews.py
index 0dc4abb..2d6cdc3 100644
--- a/patchwork/tests/test_mboxviews.py
+++ b/patchwork/tests/test_mboxviews.py
@@ -39,21 +39,33 @@ class MboxPatchResponseTest(TestCase):
"""Test that the mbox view appends the Acked-by from a patch comment."""
def setUp(self):
- project = create_project()
+ self.project = create_project()
self.person = create_person()
- self.patch = create_patch(
- project=project,
+
+ def test_patch_response(self):
+ patch = create_patch(
+ project=self.project,
submitter=self.person,
content='comment 1 text\nAcked-by: 1\n')
- self.comment = create_comment(
- submission=self.patch,
+ create_comment(
+ submission=patch,
submitter=self.person,
content='comment 2 text\nAcked-by: 2\n')
-
- def test_patch_response(self):
- response = self.client.get(reverse('patch-mbox', args=[self.patch.id]))
+ response = self.client.get(reverse('patch-mbox', args=[patch.id]))
self.assertContains(response, 'Acked-by: 1\nAcked-by: 2\n')
+ def test_patch_utf8_nbsp(self):
+ patch = create_patch(
+ project=self.project,
+ submitter=self.person,
+ content='patch text\n')
+ create_comment(
+ submission=patch,
+ submitter=self.person,
+ content=u'comment\nAcked-by:\u00A0 foo')
+ response = self.client.get(reverse('patch-mbox', args=[patch.id]))
+ self.assertContains(response, u'\u00A0 foo\n')
+
class MboxPatchSplitResponseTest(TestCase):