def render_inclusion(func, file_name, takes_context, django_context, *args, **kwargs):
 if takes_context:
  args = ([django_context] + list(args))
 _dict = func(*args, **kwargs)
 if isinstance(file_name, Template):
  t = file_name
 elif ((not isinstance(file_name, basestring)) and is_iterable(file_name)):
  t = select_template(file_name)
 else:
  t = get_template(file_name)
 nodelist = t.nodelist
 new_context = Context(_dict)
 csrf_token = django_context.get('csrf_token', None)
 if (csrf_token is not None):
  new_context['csrf_token'] = csrf_token
 return nodelist.render(new_context)

def render_inclusion ( func , file_name , takes_context , django_context , * args , ** kwargs ) : if takes_context : args = ( [ django_context ] + list ( args ) ) _dict = func ( * args , ** kwargs ) if isinstance ( file_name , Template ) : t = file_name elif ( ( not isinstance ( file_name , basestring ) ) and is_iterable ( file_name ) ) : t = select_template ( file_name ) else : t = get_template ( file_name ) nodelist = t . nodelist new_context = Context ( _dict ) csrf_token = django_context . get ( 'csrf_token' , None ) if ( csrf_token is not None ) : new_context [ 'csrf_token' ] = csrf_token return nodelist . render ( new_context )
this allows a mako template to call a template tag function that is an "inclusion tag" .