#NEWLINE# def render_template( self , template_file , values = None ) : #NEWLINE# #INDENT# ' Renders a template file with all variables loaded.\n\n    Args: \n      template_file: A str with the relative path to template file.\n      values: A dict with key/value pairs used as variables in the jinja\n        template files.\n    Returns:\n      A str with the rendered template.\n    ' #NEWLINE# if ( values is None ) : #NEWLINE# #INDENT# values = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# owned_apps = self . dstore . get_owned_apps ( ) #NEWLINE# self . helper . update_cookie_app_list ( owned_apps , self . request , self . response ) #NEWLINE# template = jinja_environment . get_template ( template_file ) #NEWLINE# sub_vars = { #NEWLINE# #INDENT# 'logged_in' : self . helper . is_user_logged_in ( ) , #NEWLINE# 'user_email' : self . helper . get_user_email ( ) , #NEWLINE# 'is_user_cloud_admin' : self . dstore . is_user_cloud_admin ( ) , #NEWLINE# 'can_upload_apps' : self . dstore . can_upload_apps ( ) , #NEWLINE# 'apps_user_is_admin_on' : owned_apps , #NEWLINE# 'flower_url' : self . dstore . get_flower_url ( ) , #NEWLINE# 'monit_url' : self . dstore . get_monit_url ( ) , #NEWLINE# #UNINDENT# } #NEWLINE# for key in values . keys ( ) : #NEWLINE# #INDENT# sub_vars [ key ] = values [ key ] #NEWLINE# #UNINDENT# return template . render ( sub_vars )