Mercurial > hg-stable
changeset 22635:660861a6fad4
templater: inline global 'path' list in templatepaths
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Sun, 28 Sep 2014 16:57:37 +0200 |
parents | e48a5d3996c2 |
children | d844e220792a |
files | mercurial/templater.py |
diffstat | 1 files changed, 4 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templater.py Sun Sep 28 16:57:37 2014 +0200 +++ b/mercurial/templater.py Sun Sep 28 16:57:37 2014 +0200 @@ -553,7 +553,6 @@ # template engine -path = ['templates', '../templates'] stringify = templatefilters.stringify def _flatten(thing): @@ -712,16 +711,10 @@ def templatepaths(): '''return locations used for template files.''' - normpaths = [] - for f in path: - if f.startswith('/'): - p = f - else: - fl = f.split('/') - p = os.path.join(util.datapath, *fl) - if os.path.isdir(p): - normpaths.append(os.path.normpath(p)) - return normpaths + pathsrel = ['templates', '../templates'] + paths = [os.path.normpath(os.path.join(util.datapath, f)) + for f in pathsrel] + return [p for p in paths if os.path.isdir(p)] def templatepath(name): '''return location of template file. returns None if not found.'''