

def loop_template_list(loop_positions, instance, instance_type, default_template, registery={
    
}):
    '\n    Build a list of templates from a position within a loop\n    and a registery of templates.\n    '
    templates = []
    local_loop_position = loop_positions[1]
    global_loop_position = loop_positions[0]
    instance_string = slugify(str(instance))
    for key in [('%s-%s' % (instance_type, instance_string)), instance_string, instance_type, 'default']:
        try:
            templates.append(registery[key][global_loop_position])
        except KeyError:
            pass
    templates.append(append_position(default_template, global_loop_position, '-'))
    templates.append(append_position(default_template, local_loop_position, '_'))
    templates.append(default_template)
    return templates

dataset/ETHPy150Open Fantomas42/django-blog-zinnia/zinnia/templates.py loop_template_list/original