#NEWLINE# def _inherit_from( context , uri , calling_uri ) : #NEWLINE# #INDENT# "called by the _inherit method in template modules to set\n    up the inheritance chain at the start of a template's\n    execution." #NEWLINE# if ( uri is None ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# template = _lookup_template ( context , uri , calling_uri ) #NEWLINE# self_ns = context [ 'self' ] #NEWLINE# ih = self_ns #NEWLINE# while ( ih . inherits is not None ) : #NEWLINE# #INDENT# ih = ih . inherits #NEWLINE# #UNINDENT# lclcontext = context . locals_ ( { #NEWLINE# #INDENT# 'next' : ih , #NEWLINE# #UNINDENT# } ) #NEWLINE# ih . inherits = TemplateNamespace ( ( 'self:%s' % template . uri ) , lclcontext , template = template , populate_self = False ) #NEWLINE# context . _data [ 'parent' ] = lclcontext . _data [ 'local' ] = ih . inherits #NEWLINE# callable_ = getattr ( template . module , '_mako_inherit' , None ) #NEWLINE# if ( callable_ is not None ) : #NEWLINE# #INDENT# ret = callable_ ( template , lclcontext ) #NEWLINE# if ret : #NEWLINE# #INDENT# return ret #NEWLINE# #UNINDENT# #UNINDENT# gen_ns = getattr ( template . module , '_mako_generate_namespaces' , None ) #NEWLINE# if ( gen_ns is not None ) : #NEWLINE# #INDENT# gen_ns ( context ) #NEWLINE# #UNINDENT# return ( template . callable_ , lclcontext )