#NEWLINE# @ register . assignment_tag ( takes_context = True ) #NEWLINE# def zinnia_loop_template( context , default_template ) : #NEWLINE# #INDENT# '\n    Return a selected template from his position within a loop\n    and the filtering context.\n    ' #NEWLINE# ( matching , context_object ) = get_context_first_matching_object ( context , [ 'category' , 'tag' , 'author' , 'pattern' , 'year' , 'month' , 'week' , 'day' ] ) #NEWLINE# context_positions = get_context_loop_positions ( context ) #NEWLINE# templates = loop_template_list ( context_positions , context_object , matching , default_template , ENTRY_LOOP_TEMPLATES ) #NEWLINE# return select_template ( templates )