#NEWLINE# def _saveReview( self , session , account , revision_key , approvals , message , upload , submit ) : #NEWLINE# #INDENT# message_key = None #NEWLINE# revision = session . getRevision ( revision_key ) #NEWLINE# change = revision . change #NEWLINE# draft_approvals = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for approval in change . draft_approvals : #NEWLINE# #INDENT# draft_approvals [ approval . category ] = approval #NEWLINE# #UNINDENT# categories = set ( ) #NEWLINE# for label in change . permitted_labels : #NEWLINE# #INDENT# categories . add ( label . category ) #NEWLINE# #UNINDENT# for category in categories : #NEWLINE# #INDENT# value = approvals . get ( category , 0 ) #NEWLINE# approval = draft_approvals . get ( category ) #NEWLINE# if ( not approval ) : #NEWLINE# #INDENT# approval = change . createApproval ( account , category , 0 , draft = True ) #NEWLINE# draft_approvals [ category ] = approval #NEWLINE# #UNINDENT# approval . value = value #NEWLINE# #UNINDENT# draft_message = revision . getPendingMessage ( ) #NEWLINE# if ( not draft_message ) : #NEWLINE# #INDENT# draft_message = revision . getDraftMessage ( ) #NEWLINE# #UNINDENT# if ( not draft_message ) : #NEWLINE# #INDENT# if ( message or upload ) : #NEWLINE# #INDENT# draft_message = revision . createMessage ( None , account , datetime . datetime . utcnow ( ) , '' , draft = True ) #NEWLINE# #UNINDENT# #UNINDENT# if draft_message : #NEWLINE# #INDENT# draft_message . created = datetime . datetime . utcnow ( ) #NEWLINE# draft_message . message = message #NEWLINE# draft_message . pending = upload #NEWLINE# message_key = draft_message . key #NEWLINE# #UNINDENT# if upload : #NEWLINE# #INDENT# change . reviewed = True #NEWLINE# self . project_cache . clear ( change . project ) #NEWLINE# #UNINDENT# if submit : #NEWLINE# #INDENT# change . status = 'SUBMITTED' #NEWLINE# change . pending_status = True #NEWLINE# change . pending_status_message = None #NEWLINE# #UNINDENT# return message_key