comparison mercurial/templater.py @ 36443:8dbd97aef915

templater: move specialized exception types to top I'm going to add one more exception type.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 25 Feb 2018 12:47:53 +0900
parents c6ce479f7a28
children 717a279c0c21
comparison
equal deleted inserted replaced
36442:e46b24582fa0 36443:8dbd97aef915
27 scmutil, 27 scmutil,
28 templatefilters, 28 templatefilters,
29 templatekw, 29 templatekw,
30 util, 30 util,
31 ) 31 )
32
33 class TemplateNotFound(error.Abort):
34 pass
32 35
33 # template parsing 36 # template parsing
34 37
35 elements = { 38 elements = {
36 # token-type: binding-strength, primary, prefix, infix, suffix 39 # token-type: binding-strength, primary, prefix, infix, suffix
1463 val = val[1].split(':', 1) 1466 val = val[1].split(':', 1)
1464 tmap[key] = val[0], os.path.join(base, val[1]) 1467 tmap[key] = val[0], os.path.join(base, val[1])
1465 aliases.extend(conf['templatealias'].items()) 1468 aliases.extend(conf['templatealias'].items())
1466 return cache, tmap, aliases 1469 return cache, tmap, aliases
1467 1470
1468 class TemplateNotFound(error.Abort):
1469 pass
1470
1471 class templater(object): 1471 class templater(object):
1472 1472
1473 def __init__(self, filters=None, defaults=None, resources=None, 1473 def __init__(self, filters=None, defaults=None, resources=None,
1474 cache=None, aliases=(), minchunk=1024, maxchunk=65536): 1474 cache=None, aliases=(), minchunk=1024, maxchunk=65536):
1475 """Create template engine optionally with preloaded template fragments 1475 """Create template engine optionally with preloaded template fragments