Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/webcommands.py @ 8236:9f53e203a09b
webcommands: move nonempty logic from JavaScript to Python
This avoids hard-coding the '(none)' string in the JavaScript for each
style and avoids the {nonexisting|nonempty} hack which only works
since the template system don't complain about undefined variables.
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Tue, 28 Apr 2009 17:28:00 +0200 |
parents | 46293a0c7e9f |
children | eefcb59d44d6 |
comparison
equal
deleted
inserted
replaced
8235:89bc3946c8f3 | 8236:9f53e203a09b |
---|---|
644 data = [] | 644 data = [] |
645 for (ctx, vtx, edges) in tree: | 645 for (ctx, vtx, edges) in tree: |
646 node = short(ctx.node()) | 646 node = short(ctx.node()) |
647 age = templatefilters.age(ctx.date()) | 647 age = templatefilters.age(ctx.date()) |
648 desc = templatefilters.firstline(ctx.description()) | 648 desc = templatefilters.firstline(ctx.description()) |
649 desc = cgi.escape(desc) | 649 desc = cgi.escape(templatefilters.nonempty(desc)) |
650 user = cgi.escape(templatefilters.person(ctx.user())) | 650 user = cgi.escape(templatefilters.person(ctx.user())) |
651 branch = ctx.branch() | 651 branch = ctx.branch() |
652 branch = branch, web.repo.branchtags().get(branch) == ctx.node() | 652 branch = branch, web.repo.branchtags().get(branch) == ctx.node() |
653 data.append((node, vtx, edges, desc, user, age, branch, ctx.tags())) | 653 data.append((node, vtx, edges, desc, user, age, branch, ctx.tags())) |
654 | 654 |