def _render_certificate_template(request, context, course, user_certificate):
 if settings.FEATURES.get('CUSTOM_CERTIFICATE_TEMPLATES_ENABLED', False):
  custom_template = get_certificate_template(course.id, user_certificate.mode)
  if custom_template:
   template = Template(custom_template, output_encoding='utf-8', input_encoding='utf-8', default_filters=['decode.utf8'], encoding_errors='replace')
   context = RequestContext(request, context)
   return HttpResponse(template.render(context))
 return render_to_response('certificates/valid.html', context)

def _render_certificate_template ( request , context , course , user_certificate ) : if settings . FEATURES . get ( 'CUSTOM_CERTIFICATE_TEMPLATES_ENABLED' , False ) : custom_template = get_certificate_template ( course . id , user_certificate . mode ) if custom_template : template = Template ( custom_template , output_encoding = 'utf-8' , input_encoding = 'utf-8' , default_filters = [ 'decode.utf8' ] , encoding_errors = 'replace' ) context = RequestContext ( request , context ) return HttpResponse ( template . render ( context ) ) return render_to_response ( 'certificates/valid.html' , context )
picks appropriate certificate templates and renders it .