#NEWLINE# def Render( self , template_path , values , write_to_response = True ) : #NEWLINE# #INDENT# 'Renders a template using supplied data values and returns HTML.\n\n    Args:\n      template_path: str path of template.\n      values: dict of template values.\n      write_to_response: bool, True to write to response.out.write().\n    Returns:\n      str HTML of rendered template.\n    ' #NEWLINE# path = os . path . join ( os . path . dirname ( __file__ ) , 'templates' , template_path ) #NEWLINE# if ( not settings . DEV_APPSERVER ) : #NEWLINE# #INDENT# values [ 'static_path' ] = ( 'myapp/%s' % os . getenv ( 'CURRENT_VERSION_ID' ) ) #NEWLINE# #UNINDENT# values [ 'is_admin' ] = self . IsAdminUser ( ) #NEWLINE# if ( not hasattr ( self , '_menu' ) ) : #NEWLINE# #INDENT# self . _menu = GetMenu ( ) #NEWLINE# #UNINDENT# values [ 'menu' ] = self . _menu #NEWLINE# if ( not settings . APPROVAL_REQUIRED ) : #NEWLINE# #INDENT# if ( 'proposals' in values [ 'menu' ] [ 'munki_packages' ] [ 'subitems' ] ) : #NEWLINE# #INDENT# del values [ 'menu' ] [ 'munki_packages' ] [ 'subitems' ] [ 'proposals' ] #NEWLINE# #UNINDENT# #UNINDENT# if ( 'msg' not in values ) : #NEWLINE# #INDENT# values [ 'msg' ] = self . request . GET . get ( 'msg' ) #NEWLINE# #UNINDENT# if ( 'report_type' not in values ) : #NEWLINE# #INDENT# values [ 'report_type' ] = 'undefined_report' #NEWLINE# #UNINDENT# if self . XSRF_PROTECT : #NEWLINE# #INDENT# values [ 'xsrf_token' ] = xsrf . XsrfTokenGenerate ( values [ 'report_type' ] ) #NEWLINE# #UNINDENT# if hasattr ( self , '_page' ) : #NEWLINE# #INDENT# values [ 'limit' ] = self . _page . get ( 'limit' ) #NEWLINE# values [ 'next_page' ] = self . _page . get ( 'next_page' ) #NEWLINE# values [ 'results_count' ] = self . _page . get ( 'results_count' ) #NEWLINE# values [ 'limits' ] = QUERY_LIMITS #NEWLINE# values [ 'request_query_params' ] = self . request . GET #NEWLINE# values [ 'request_path' ] = self . request . path #NEWLINE# if self . _page . get ( 'next_page' ) : #NEWLINE# #INDENT# query_params = self . request . GET . copy ( ) #NEWLINE# query_params [ 'page' ] = self . _page . get ( 'next_page' ) #NEWLINE# values [ 'next_page_link' ] = ( '%s?%s' % ( self . request . path , urllib . urlencode ( query_params , doseq = True ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# html = template . render ( path , values ) #NEWLINE# if write_to_response : #NEWLINE# #INDENT# self . response . out . write ( html ) #NEWLINE# #UNINDENT# return html