Ticket Milestone Display Macro
Description
This macro will display a linked ticket number and linked milestone.
This is useful for svn commit messages. If all revisions are committed with this macro, you will see the revision logs with both its related ticket number and milestone.
[[tm(10)]] gives you [Ticket !#10 Milestone 1.0]
Question for the Community (help needed)
Being new to writing macros, I understand the old style macros will not be supported in v.11, but I don't quite understand how to make this macro into a plugin using eggs. If anybody can provide a bit of help with this, I will upload the plugin after it's done.
Also, I would like to simplify the command. Currently it is
[[tm(10)]]
Is it possible to change this to something simpler like
[[#10]] or [[tm10]]
Any help is much appreciated!
Source
Save this to a file (tm.py) and place in your plugins/wiki-macros directory, just as you would do with other old style macros
""" Lists ticket and milestone information This macro takes one parameter, the ticket id """ from StringIO import StringIO def execute(hdf, args, env): db = env.get_db_cnx() cursor = db.cursor() sql = "SELECT id, milestone FROM ticket WHERE id = '%s'" % args cursor.execute(sql) buf = StringIO() row = cursor.fetchone() if row == None: buf.write('Ticket with ID "%s" was not found' % args) else: buf.write('[<a href="%s">Ticket #%s</a>, <a href="%s">Milestone: %s</a>]' % (env.href.ticket(row[0]), row[0], env.href.milestone(row[1]), row[1])) return buf.getvalue()
Bugs/Feature Requests
Existing bugs and feature requests for TicketMilestoneDisplayMacro are here.
If you have any issues, create a new ticket.
Recent Changes
[2345] by fsbojason on 06/27/07 19:49:18
New hack TicketMilestoneDisplayMacro, created by fsbojason
Author/Contributors
Author: fsbojason
Contributors:
Attachments
- tm.py (0.6 kB) -
Macro File
, added by fsbojason on 06/27/07 20:04:23.