Mercurial > public > mercurial-scm > hg-stable
diff mercurial/templatefuncs.py @ 38237:d48b80d58848
templater: unify unwrapvalue() with _unwrapvalue()
All weird generators got removed from the hgweb codebase. We still have
inconsistent behavior regarding join() of a byte string, which will be
addressed later.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 04 Apr 2018 21:06:14 +0900 |
parents | bd7a3fa71a72 |
children | 1c8098cf560a |
line wrap: on
line diff
--- a/mercurial/templatefuncs.py Wed Apr 04 21:01:21 2018 +0900 +++ b/mercurial/templatefuncs.py Wed Apr 04 21:06:14 2018 +0900 @@ -333,8 +333,9 @@ joiner = evalstring(context, mapping, args[1]) if isinstance(joinset, templateutil.wrapped): return joinset.join(context, mapping, joiner) - # TODO: perhaps a generator should be stringify()-ed here, but we can't - # because hgweb abuses it as a keyword that returns a list of dicts. + # TODO: rethink about join() of a byte string, which had no defined + # behavior since a string may be either a bytes or a generator. + # TODO: fix type error on join() of non-iterable joinset = templateutil.unwrapvalue(context, mapping, joinset) return templateutil.joinitems(pycompat.maybebytestr(joinset), joiner)