Index: PlannedMilestones.py =================================================================== --- PlannedMilestones.py (revision 964) +++ PlannedMilestones.py (working copy) @@ -1,3 +1,64 @@ +""" +Inserts a list of upcoming milestones matching a given string. If no string is +given, inserts a list of all upcoming milestones. + +Examples: + +{{{ + [[PlannedMilestones]] +}}} + +Outputs: + +{{{ +#!html +
+
+
+None +
+}}} + + +""" + +import re from StringIO import StringIO from trac.util import Markup, format_date from trac.ticket import Milestone @@ -3,14 +64,27 @@ def execute(hdf, txt, env): + if txt == None: txt = '' + + pattern = re.compile( re.escape(txt) ) + milestones = [] + for milestone in Milestone.select(env, include_completed=False): + if pattern.match( milestone.name ): + milestones.append( milestone ) + out = StringIO() - out.write('