> something like
> select name,due,completed from milestone where completed > 0 order by name
> ?
The macro code:
from datetime import datetime
from genshi.builder import tag
from trac.ticket import Milestone
from trac.util.datefmt import format_datetime, utc
from trac.wiki.api import parse_args
from trac.wiki.macros import WikiMacroBase
class MilestonesMacro(WikiMacroBase):
"""Show a list of milestones
This macro accepts a comma-separated list of optional formatters:
- `all` shows all milestones
- `format` is a keyed parameter accepting a Python time formatting string
"""
def expand_macro(self, formatter, name, content):
def milestone_anchor(milestone):
return tag.a(milestone.name,
href=formatter.href.milestone(milestone.name))
formatter.perm.require('MILESTONE_VIEW')
largs, kwargs = parse_args(content)
milestones = Milestone.select(self.env, True)
if 'all' not in largs:
milestones = [m for m in milestones if m.completed]
return tag.div(tag.dl([(tag.dt(milestone_anchor(milestone)),
tag.dd(format_datetime(milestone.due,
kwargs.get('format','%x'))))
for milestone in milestones],
class_='wiki compact'))
--
You received this message because you are subscribed to the Google Groups "Trac
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/trac-users?hl=en.