Patchwork [15,of,23,Series-D] hgweb: simplify return value creation in for navgen

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 11, 2013, 12:24 a.m.
Message ID <6efba5b8d479f0381905.1357863840@yamac.lan>
Download mbox | patch
Permalink /patch/526/
State Superseded
Headers show

Comments

Pierre-Yves David - Jan. 11, 2013, 12:24 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1357862338 -3600
# Node ID 6efba5b8d479f0381905f69cab459e440a57ec72
# Parent  824dd4eea09fbcf9cf9033aafc23e5699a6ea8ab
hgweb: simplify return value creation in for navgen

We now have access to better syntax allowing a clearer version.

Patch

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -82,15 +82,15 @@  class revnav(object):
         except error.RepoError:
             pass
 
         def gen(l):
             def f(**map):
-                for label, node in l:
-                    yield {"label": label, "node": node}
+                return ({"label": i[0], "node": i[1]} for i in l)
             return f
 
-        return (dict(before=gen(navbefore), after=gen(navafter)),)
+        return ({'before':gen(navbefore),
+                 'after': gen(navafter)},)
 
 def _siblings(siblings=[], hiderev=None):
     siblings = [s for s in siblings if s.node() != nullid]
     if len(siblings) == 1 and siblings[0].rev() == hiderev:
         return