#NEWLINE# def list_view( self , document_id ) : #NEWLINE# #INDENT# document = self . _get_document ( a ) #NEWLINE# query = Attachment . select ( Attachment , BlobData ) . join ( BlobData , on = ( Attachment . hash == BlobData . hash ) . alias ( '_blob' ) ) . where ( ( Attachment . document == document ) ) #NEWLINE# ordering = request . args . getlist ( 'ordering' ) #NEWLINE# query = Attachment . apply_rank_and_sort ( query , None , ordering ) #NEWLINE# pq = self . paginated_query ( query ) #NEWLINE# return jsonify ( { #NEWLINE# #INDENT# 'attachments' : [ a . serialize ( ) for a in pq . get_object_list ( ) ] , #NEWLINE# 'ordering' : ordering , #NEWLINE# 'page' : pq . get_page ( ) , #NEWLINE# 'pages' : pq . get_page_count ( ) , #NEWLINE# #UNINDENT# } )