# HG changeset patch # User Pierre-Yves David # Date 1358178755 -3600 # Node ID 083daee1b7492cac49bdcd348f1dc632624f1257 # Parent 39616410aa32d95d9b1827db9210cf5c93abd146 hgweb: simplify return value creation in for navgen We now have access to better syntax allowing a clearer version. diff -r 39616410aa32 -r 083daee1b749 mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py Thu Jan 10 18:55:50 2013 +0100 +++ b/mercurial/hgweb/webutil.py Mon Jan 14 16:52:35 2013 +0100 @@ -70,13 +70,9 @@ except error.RepoError: pass - def gen(l): - def f(**map): - for label, node in l: - yield {"label": label, "node": node} - return f - - return (dict(before=gen(navbefore), after=gen(navafter)),) + data = lambda i: {"label": i[0], "node": i[1]} + return ({'before': lambda **map: (data(i) for i in navbefore), + 'after': lambda **map: (data(i) for i in navafter)},) def _siblings(siblings=[], hiderev=None): siblings = [s for s in siblings if s.node() != nullid]