#NEWLINE# def serialize_comments( self , comments ) : #NEWLINE# #INDENT# 'Serializes the comments for the review UI target.\n\n        By default, this will return a list of serialized comments,\n        but it can be overridden to return other list or dictionary-based\n        representations, such as comments grouped by an identifier or region.\n        These representations must be serializable into JSON.\n        ' #NEWLINE# user = self . request . user #NEWLINE# result = [ ] #NEWLINE# for comment in comments : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# review = comment . get_review ( ) #NEWLINE# #UNINDENT# except Review . DoesNotExist : #NEWLINE# #INDENT# logging . error ( ( 'Missing Review for comment %r' % comment ) ) #NEWLINE# continue #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# if ( review and ( review . public or ( review . user == user ) ) ) : #NEWLINE# #INDENT# result . append ( self . serialize_comment ( comment ) ) #NEWLINE# #UNINDENT# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# logging . error ( 'Error when calling serialize_comment for FileAttachmentReviewUI %r: %s' , self , e , exc_info = 1 ) #NEWLINE# #UNINDENT# #UNINDENT# return result