#NEWLINE# def _generate_pdf( self , state = None ) : #NEWLINE# #INDENT# customer = Customer ( ** self . archived_customer ) #NEWLINE# provider = Provider ( ** self . archived_provider ) #NEWLINE# if ( state is None ) : #NEWLINE# #INDENT# state = self . state #NEWLINE# #UNINDENT# context = { #NEWLINE# #INDENT# 'document' : self , #NEWLINE# 'provider' : provider , #NEWLINE# 'customer' : customer , #NEWLINE# 'entries' : self . _entries , #NEWLINE# 'state' : state , #NEWLINE# #UNINDENT# } #NEWLINE# provider_state_template = '{provider}/{kind}_{state}_pdf.html' . format ( kind = self . kind , provider = self . provider . slug , state = state ) . lower ( ) #NEWLINE# provider_template = '{provider}/{kind}_pdf.html' . format ( kind = self . kind , provider = self . provider . slug ) . lower ( ) #NEWLINE# generic_state_template = '{kind}_{state}_pdf.html' . format ( kind = self . kind , state = state ) . lower ( ) #NEWLINE# generic_template = '{kind}_pdf.html' . format ( kind = self . kind ) . lower ( ) #NEWLINE# _templates = [ provider_state_template , provider_template , generic_state_template , generic_template ] #NEWLINE# templates = [ ] #NEWLINE# for t in _templates : #NEWLINE# #INDENT# templates . append ( ( 'billing_documents/' + t ) ) #NEWLINE# #UNINDENT# template = select_template ( provider_state_template ) #NEWLINE# file_object = HttpResponse ( content_type = 'application/pdf' ) #NEWLINE# generate_pdf_template_object ( template , file_object , context ) #NEWLINE# return file_object