Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/templateutil.py @ 37073:1101d6747d2d
templater: drop 'templ' from resources dict
Partially resolves cycle, templ -> context -> templ. This will make it easier
to replace the resources dict with new immutable resource mapper interface.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 16 Mar 2018 23:09:21 +0900 |
parents | aa97e06a1912 |
children | 44757e6dad93 |
comparison
equal
deleted
inserted
replaced
37072:724f2e21d870 | 37073:1101d6747d2d |
---|---|
346 v = context.process(key, safemapping) | 346 v = context.process(key, safemapping) |
347 except TemplateNotFound: | 347 except TemplateNotFound: |
348 v = default | 348 v = default |
349 if callable(v) and getattr(v, '_requires', None) is None: | 349 if callable(v) and getattr(v, '_requires', None) is None: |
350 # old templatekw: expand all keywords and resources | 350 # old templatekw: expand all keywords and resources |
351 # (TODO: deprecate this after porting web template keywords to new API) | |
351 props = {k: f(context, mapping, k) | 352 props = {k: f(context, mapping, k) |
352 for k, f in context._resources.items()} | 353 for k, f in context._resources.items()} |
354 # pass context to _showcompatlist() through templatekw._showlist() | |
355 props['templ'] = context | |
353 props.update(mapping) | 356 props.update(mapping) |
354 return v(**pycompat.strkwargs(props)) | 357 return v(**pycompat.strkwargs(props)) |
355 if callable(v): | 358 if callable(v): |
356 # new templatekw | 359 # new templatekw |
357 try: | 360 try: |