#NEWLINE# def view( request , path , template_name = 'templated_emails/view.html' ) : #NEWLINE# #INDENT# if ( not request . user . is_superuser ) : #NEWLINE# #INDENT# raise Http404 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# rendered_subject = '' #NEWLINE# rendered_html = '' #NEWLINE# rendered_text = '' #NEWLINE# try : #NEWLINE# #INDENT# template = get_template ( ( 'emails%s/email.html' % rendered_text ) ) #NEWLINE# rendered_html = recursive_block_replace ( template , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# logger . exception ( 'Error rendering templated email email.html' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# template = get_template ( ( 'emails%s/email.txt' % path ) ) #NEWLINE# rendered_text = recursive_block_replace ( template , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# logger . exception ( 'Error rendering templated email email.txt' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# template = get_template ( ( 'emails%s/short.txt' % path ) ) #NEWLINE# rendered_subject = recursive_block_replace ( template , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# logger . exception ( 'Error rendering templated email short.txt' ) #NEWLINE# #UNINDENT# return render_to_response ( template_name , { #NEWLINE# #INDENT# 'rendered_subject' : rendered_subject , #NEWLINE# 'rendered_html' : rendered_html , #NEWLINE# 'rendered_text' : rendered_text , #NEWLINE# #UNINDENT# } , context_instance = RequestContext ( request ) )