#NEWLINE# def serialize( self ) : #NEWLINE# #INDENT# if hasattr ( self , 'document_count' ) : #NEWLINE# #INDENT# document_count = self . document_count #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# document_count = self . documents . count ( ) #NEWLINE# #UNINDENT# return { #NEWLINE# #INDENT# 'id' : document_count . id , #NEWLINE# 'name' : self . name , #NEWLINE# 'documents' : url_for ( 'index_view_detail' , pk = self . name ) , #NEWLINE# 'document_count' : document_count , #NEWLINE# #UNINDENT# }