On 28 Nov 10:14, Mauro Carvalho Chehab wrote: > When a patch is delegated, it can be important to report it via > pwclient, as handing delegated patches may be different. So, add > an optional field at the email's body if this is happening. > > Signed-off-by: Mauro Carvalho Chehab <[email protected]> > --- > patchwork/models.py | 54 > +++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 54 insertions(+) > > diff --git a/patchwork/models.py b/patchwork/models.py > index e552217a3cbc..024ff4d8d5e1 100644 > --- a/patchwork/models.py > +++ b/patchwork/models.py > @@ -323,6 +323,60 @@ class Patch(models.Model): > str = fname_re.sub('-', self.name) > 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) > + except Exception: > + pass > + > + body = '' > + 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 = '' > + > + for comment in Comment.objects.filter(patch = self) \ > + .exclude(msgid = self.msgid): > + body += comment.patch_responses() > + > + if body: > + body += '\n' > + > + if postscript: > + body += '---\n' + postscript.strip() + '\n' > + > + if self.content: > + body += '\n' + self.content > + > + mail = PatchMbox(body) > + mail['Subject'] = self.name > + mail['Date'] = email.utils.formatdate( > + time.mktime(self.date.utctimetuple())) > + mail['From'] = unicode(self.submitter) > + mail['X-Patchwork-Id'] = str(self.id) > + if self.delegate: > + mail['X-Patchwork-Delegate'] = str(self.delegate.email)
[snip] You seem to be missing a couple of dependencies here: it fails to run because of missing imports and the code looks like a minor modification of functionality found in 'patchwork/views/__init__.py'. Is there any reason we can't just include the above 'X-Patchwork-Delegate' lines in the 'patch_to_mbox' function found in the aforementioned file? Stephen _______________________________________________ Patchwork mailing list [email protected] https://lists.ozlabs.org/listinfo/patchwork
