#NEWLINE# def serialize( self , include_score = False ) : #NEWLINE# #INDENT# data_params = { #NEWLINE# #INDENT# 'document_id' : self . document_id , #NEWLINE# 'pk' : self . filename , #NEWLINE# #UNINDENT# } #NEWLINE# if app . config [ 'AUTHENTICATION' ] : #NEWLINE# #INDENT# data_params [ 'key' ] = app . config [ 'AUTHENTICATION' ] #NEWLINE# #UNINDENT# data = { #NEWLINE# #INDENT# 'filename' : self . filename , #NEWLINE# 'mimetype' : self . mimetype , #NEWLINE# 'timestamp' : str ( self . timestamp ) , #NEWLINE# 'data_length' : self . length , #NEWLINE# 'document' : url_for ( 'document_view_detail' , pk = self . document_id ) , #NEWLINE# 'data' : url_for ( 'attachment_download' , ** data_params ) , #NEWLINE# #UNINDENT# } #NEWLINE# if include_score : #NEWLINE# #INDENT# data [ 'score' ] = self . score #NEWLINE# #UNINDENT# return data