Roundup Wiki

The following will download the messages spool for an issue as an mbox file. It's intended to be dropped into the extensions directory of a 0.8 or later tracker. It'll work with 0.7, but the registration interface has changed (the init bit at the end is 0.8-or-later).

The code:

from roundup.cgi.actions import Action

class MboxAction(Action):
    def handle(self):
        if self.classname != 'issue':
            raise ValueError, 'Can only download messages mbox for issues'
        if self.nodeid is None:
            raise ValueError, 'Can only download messages mbox for single issues'

        r = []
        a = r.append
        msg = self.db.msg
        user = self.db.user
        for msgid in self.db.issue.get(self.nodeid, 'messages'):
            author = msg.get(msgid, 'author')
            date = msg.get(msgid, 'date')
            sdate = date.pretty('%a, %d %b %Y %H:%M:%S +0000')
            a('From %s %s'%(user.get(author, 'address'), sdate))
            a('From: %s'%user.get(author, 'address'))
            a('Message-Id: %s'%msg.get(msgid, 'messageid'))
            inreplyto = msg.get(msgid, 'inreplyto')
            if inreplyto:
                a('In-Reply-To: %s'%inreplyto)
            body = msg.get(msgid, 'content').splitlines()
            for line in range(len(body)):
                if body[line].startswith('From '):
                    body[line] = '>'+body['line']
                a(body[line])
            a('\n')

        h = self.client.additional_headers
        h['Content-Type'] = 'application/mbox'

        self.client.header()
        if self.client.env['REQUEST_METHOD'] == 'HEAD':
            # all done, return a dummy string
            return 'dummy'

        return '\n'.join(r)


def init(tracker):
    tracker.registerAction('mbox', MboxAction)

-- RichardJones

From wiki Sat Jul 29 11:12:31 +1000 2006 From: wiki Date: Sat, 29 Jul 2006 11:12:31 +1000 Subject: The usage bit Message-ID: <20060729111231+1000@www.mechanicalcat.net>

To use it, I created a link: &lt;a href="#" tal:attributes="href string:issue${context/id}?@action=mbox" i18n:translate=""&gt;Download&lt;/a&gt; (should work fine in the issue.item.html template)

From twb Fri Jan 23 14:37:20 +1100 2009 From: Trent W. Buck <trentbuck@gmail.com> Date: Tue, 20 Jan 2009 12:04:44 +1100 Subject: New version Message-ID: <301vuyzt1v.fsf@Clio.twb.ath.cx>

I have worked on improving this extension, the code of which can be seen at http://bugs.darcs.net/issue1148 and the results of which can be seen at e.g. http://bugs.darcs.net/issue1148?@action=mbox

I hope to improve mbox support further in future, but I don't intend to work on it in the near future. In particular:

I think the latter two are hard because AFAICT roundup "forgets" which messages are associated with which property changes and attachments.