Re: having a detector add a message to an issue

John Kristensen <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <[email protected]>
On 14/05/15 08:59, Dan Tenenbaum wrote:
> Hi,
> 
> I've written a detector that requires that new issues have a file attached to them, and that the file be a .tar.gz file containing a DESCRIPTION file. The detector appends the contents of the DESCRIPTION file to the file containing the text of the message (change note) field.
> 
> (If you're wondering why, well, these are requirements of my organization; they make sense to us but would probably not be useful to anyone else.)
> 
> This all works great if the user fills in the change note field. I simply find the file containing the contents of the change note field, which I can do by examining newvalues['messages'].
> 
> But if the user leaves the 'change note' field blank, then newvalues does not contain a 'messages' key.
> So I guess what I need to do in this case is create my own message object and link it to the issue that's being created, then open the associated file and write to it the contents of the DESCRIPTION file.
> 
> I'm not clear on how to do that. Any tips would be welcome. 
> 
> Thanks,
> Dan

Hello Dan,

Is something like the following what you are after?

----

from roundup.date import Date

def new_issue_auditor(db, cl, itemid, newvalues):
    if 'messages' in newvalues:
        return

    msg_id = db.msg.create(
        author=db.getuid(),
        date=Date('.'),
        summary='some message summary',
        content='content of message',
        files=[file_id]
    )

    newvalues['messages'] = [msg_id]

----

The only caveat is where the file_id comes from  (I don't have access to
a setup where I can play around with this at the moment). If you are
already doing something related to the file, then that may be a bit more
obvious to you than me.

Hopefully this is enough of a hint to point you in the right direction.

SeeYa,
John.


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.