X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=apps%2Fpatchwork%2Fmodels.py;h=793cb4ede5554e03d297668dee22adba576c1c3f;hb=cd874f3ef896a54c47fc4a483739b00871e5a4b4;hp=a672f9ad41ebe5f16879db45a655a42b2c5643c8;hpb=6ce62d26739ebf0dd81ecff5284adf3fbe2aed23;p=patchwork diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py index a672f9a..793cb4e 100644 --- a/apps/patchwork/models.py +++ b/apps/patchwork/models.py @@ -227,6 +227,8 @@ class Patch(models.Model): return str.strip('-') + '.patch' def mbox(self): + postscript_re = re.compile('\n-{2,3} ?\n') + comment = None try: comment = Comment.objects.get(patch = self, msgid = self.msgid) @@ -237,6 +239,14 @@ class Patch(models.Model): if comment: body = comment.content.strip() + "\n" + parts = postscript_re.split(body, 1) + if len(parts) == 2: + (body, postscript) = parts + body = body.strip() + "\n" + postscript = postscript.strip() + "\n" + else: + postscript = '' + responses = False for comment in Comment.objects.filter(patch = self) \ .exclude(msgid = self.msgid): @@ -245,7 +255,10 @@ class Patch(models.Model): if body: body += '\n' - body += self.content + if postscript: + body += '---\n' + postscript.strip() + '\n' + + body += '\n' + self.content mail = PatchMbox(body) mail['Subject'] = self.name