def render_to_string(template_name, context=None, context_instance=None, response_format='html'):
 if (context is None):
  context = {}
 if ((not response_format) or ('pdf' in response_format) or (response_format not in settings.HARDTREE_RESPONSE_FORMATS)):
  response_format = 'html'
 if (not (('.' + response_format) in template_name)):
  template_name += ('.' + response_format)
 template_name = ((response_format + '/') + template_name)
 context['response_format'] = response_format
 if context_instance:
  context['site_domain'] = RequestSite(context_instance['request']).domain
 context = _preprocess_context_html(context)
 rendered_string = loader.render_to_string(template_name, context, context_instance)
 return rendered_string

def render_to_string ( template_name , context = None , context_instance = None , response_format = 'html' ) : if ( context is None ) : context = { } if ( ( not response_format ) or ( 'pdf' in response_format ) or ( response_format not in settings . HARDTREE_RESPONSE_FORMATS ) ) : response_format = 'html' if ( not ( ( '.' + response_format ) in template_name ) ) : template_name += ( '.' + response_format ) template_name = ( ( response_format + '/' ) + template_name ) context [ 'response_format' ] = response_format if context_instance : context [ 'site_domain' ] = RequestSite ( context_instance [ 'request' ] ) . domain context = _preprocess_context_html ( context ) rendered_string = loader . render_to_string ( template_name , context , context_instance ) return rendered_string
wrapper around django .