def render_mako_string(tpldir, tplname, data, trust=True):
 show_errors = settings.DEBUG_MODE
 lookup_obj = (_TPL_LOOKUP_SAFE if (trust is False) else _TPL_LOOKUP)
 tpl = mako_cache.get(tplname)
 if (tpl is None):
  with open(os.path.join(tpldir, tplname)) as f:
   tpl_text = f.read()
  tpl = Template(tpl_text, format_exceptions=show_errors, lookup=lookup_obj, input_encoding='utf-8', output_encoding='utf-8', default_filters=lookup_obj.template_args['default_filters'], imports=lookup_obj.template_args['imports'])
 if (not app.debug):
  mako_cache[tplname] = tpl
 return tpl.render(**data)

def render_mako_string ( tpldir , tplname , data , trust = True ) : show_errors = settings . DEBUG_MODE lookup_obj = ( _TPL_LOOKUP_SAFE if ( trust is False ) else _TPL_LOOKUP ) tpl = mako_cache . get ( tplname ) if ( tpl is None ) : with open ( os . path . join ( tpldir , tplname ) ) as f : tpl_text = f . read ( ) tpl = Template ( tpl_text , format_exceptions = show_errors , lookup = lookup_obj , input_encoding = 'utf-8' , output_encoding = 'utf-8' , default_filters = lookup_obj . template_args [ 'default_filters' ] , imports = lookup_obj . template_args [ 'imports' ] ) if ( not app . debug ) : mako_cache [ tplname ] = tpl return tpl . render ( ** data )
render a mako template to a string .