'Indexes a template by `name` into the `name_to_template` dictionnary.
:param tpl: The template to index'

def index_template(self, tpl):

    objcls = self.inner_class.my_type
    name = getattr(tpl, 'name', '')
    if (not name):
        mesg = ('a    %s    template    has    been    defined    without    name%s%s' % (objcls, tpl.imported_from, self.get_source(tpl)))
        tpl.configuration_errors.append(mesg)
    elif (name in self.name_to_template):
        tpl = self.manage_conflict(tpl, name)
    self.name_to_template[name] = tpl
    return tpl
