Adding Default Descriptions to Trac Tickets

I’ve been using Trac for the new projects I’m working on, and am liking it so far. I have, however, done a bit of customization to make it fit my needs a bit better. One thing that took awhile was figuring out how to change the default ticket description.

I like having some structure to my bug descriptions, including steps to reproduce, regression information, etc. Thankfully, Trac’s template system allows you to replace output with an override template (typically found in templates/site.html) that is applied before content is sent across the wire. It was a bit time-consuming to figure out how to do what I wanted to do, but I eventually ended up with a templates/site.html file that looks something like this:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://genshi.edgewall.org/" py:strip=""> <!-- Custom match templates go here --> <span py:if="req.environ['PATH_INFO']=='/newticket' and not req.args.has_key('preview')"> <textarea py:match="textarea[@id='field-description' and @class='wikitext']" py:attrs="select('@*')"> Your custom description goes here. </textarea> </span> </html>

I hope this is useful for someone. 🙂

4 Responses to “Adding Default Descriptions to Trac Tickets”

  1. Jonathan Deutsch Says:

    I just tried this, works great! (Though for now I’m probably the only one entering tickets in my trac setup!)

  2. James Says:

    Hi, I found your blog on this new directory of WordPress Blogs at blackhatbootcamp.com/listofwordpressblogs. I dont know how your blog came up, must have been a typo, i duno. Anyways, I just clicked it and here I am. Your blog looks good. Have a nice day. James.

  3. Thadeus Says:

    thanks, helped.

  4. Peter Says:

    Yes, worked out fine. Thanks.

    (Still helpful post after almost 3 years 😀 )

Leave a Reply

Please spell "response" backwards: (required)