#NEWLINE# @ defer . inlineCallbacks #NEWLINE# def _get_event_from_row( self , internal_metadata , js , redacted , check_redacted = True , get_prev_content = False , rejected_reason = None ) : #NEWLINE# #INDENT# d = json . loads ( js ) #NEWLINE# internal_metadata = json . loads ( internal_metadata ) #NEWLINE# if rejected_reason : #NEWLINE# #INDENT# rejected_reason = ( yield self . _simple_select_one_onecol ( table = 'rejections' , keyvalues = { #NEWLINE# #INDENT# 'event_id' : rejected_reason , #NEWLINE# #UNINDENT# } , retcol = 'reason' , desc = '_get_event_from_row' ) ) #NEWLINE# #UNINDENT# ev = FrozenEvent ( d , internal_metadata_dict = internal_metadata , rejected_reason = rejected_reason ) #NEWLINE# if ( check_redacted and redacted ) : #NEWLINE# #INDENT# ev = prune_event ( ev ) #NEWLINE# redaction_id = ( yield self . _simple_select_one_onecol ( table = 'redactions' , keyvalues = { #NEWLINE# #INDENT# 'redacts' : ev . event_id , #NEWLINE# #UNINDENT# } , retcol = 'event_id' , desc = '_get_event_from_row' ) ) #NEWLINE# ev . unsigned [ 'redacted_by' ] = redaction_id #NEWLINE# because = ( yield self . get_event ( redaction_id , check_redacted = False , allow_none = True ) ) #NEWLINE# if because : #NEWLINE# #INDENT# ev . unsigned [ 'redacted_because' ] = because #NEWLINE# #UNINDENT# #UNINDENT# if ( get_prev_content and ( 'replaces_state' in ev . unsigned ) ) : #NEWLINE# #INDENT# prev = ( yield self . get_event ( ev . unsigned [ 'replaces_state' ] , get_prev_content = False , allow_none = True ) ) #NEWLINE# if prev : #NEWLINE# #INDENT# ev . unsigned [ 'prev_content' ] = prev . content #NEWLINE# ev . unsigned [ 'prev_sender' ] = prev . sender #NEWLINE# #UNINDENT# #UNINDENT# self . _get_event_cache . prefill ( ( ev . event_id , check_redacted , get_prev_content ) , ev ) #NEWLINE# defer . returnValue ( rejected_reason )