diff options
Diffstat (limited to 'apps/patchwork/models.py')
-rw-r--r-- | apps/patchwork/models.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py index a672f9a..cfc875f 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,6 +255,9 @@ class Patch(models.Model): if body: body += '\n' + if postscript: + body += '---\n' + postscript.strip() + '\n' + body += self.content mail = PatchMbox(body) |