mercurial/templater.py
changeset 14168 135e244776f0
parent 13665 e798e430c5e5
child 14925 ab545a15d807
equal deleted inserted replaced
14167:0e4753807c93 14168:135e244776f0
   309 
   309 
   310     def load(self, t):
   310     def load(self, t):
   311         '''Get the template for the given template name. Use a local cache.'''
   311         '''Get the template for the given template name. Use a local cache.'''
   312         if not t in self.cache:
   312         if not t in self.cache:
   313             try:
   313             try:
   314                 self.cache[t] = open(self.map[t][1]).read()
   314                 self.cache[t] = util.readfile(self.map[t][1])
   315             except KeyError, inst:
   315             except KeyError, inst:
   316                 raise util.Abort(_('"%s" not in template map') % inst.args[0])
   316                 raise util.Abort(_('"%s" not in template map') % inst.args[0])
   317             except IOError, inst:
   317             except IOError, inst:
   318                 raise IOError(inst.args[0], _('template file %s: %s') %
   318                 raise IOError(inst.args[0], _('template file %s: %s') %
   319                               (self.map[t][1], inst.args[1]))
   319                               (self.map[t][1], inst.args[1]))