def truncate_fields(old_value, new_value):
 max_value_length = (settings.TRACK_MAX_EVENT / 4)
 (serialized_old_value, old_was_truncated) = _get_truncated_setting_value(old_value, max_length=max_value_length)
 (serialized_new_value, new_was_truncated) = _get_truncated_setting_value(new_value, max_length=max_value_length)
 truncated_values = []
 if old_was_truncated:
  truncated_values.append('old')
 if new_was_truncated:
  truncated_values.append('new')
 return {'old': serialized_old_value, 'new': serialized_new_value, 'truncated': truncated_values}

def truncate_fields ( old_value , new_value ) : max_value_length = ( settings . TRACK_MAX_EVENT / 4 ) ( serialized_old_value , old_was_truncated ) = _get_truncated_setting_value ( old_value , max_length = max_value_length ) ( serialized_new_value , new_was_truncated ) = _get_truncated_setting_value ( new_value , max_length = max_value_length ) truncated_values = [ ] if old_was_truncated : truncated_values . append ( 'old' ) if new_was_truncated : truncated_values . append ( 'new' ) return { 'old' : serialized_old_value , 'new' : serialized_new_value , 'truncated' : truncated_values }
truncates old_value and new_value for analytics event emission if necessary .