parameters: (initial_message, changed_fields, obj)
return_statement: return {'message': message, 'source_filter': source_filter}
docstring: Processes the changed fields to determine what actually changed.
  
      :param message: An initial message to include.
      :type message: str
      :param changed_fields: A list of field names that were changed.
      :type changed_fields: list of str
      :param obj: The object.
      :type obj: class which inherits from
                 :class:`crits.core.crits_mongoengine.CritsBaseAttributes`
      :returns: str: Returns a message indicating what was changed.
docstring_summary: Processes the changed fields to determine what actually changed.
docstring_tokens: Processes the changed fields to determine what actually changed .
function: def process_changed_fields(initial_message, changed_fields, obj):
      """
      Processes the changed fields to determine what actually changed.
  
      :param message: An initial message to include.
      :type message: str
      :param changed_fields: A list of field names that were changed.
      :type changed_fields: list of str
      :param obj: The object.
      :type obj: class which inherits from
                 :class:`crits.core.crits_mongoengine.CritsBaseAttributes`
      :returns: str: Returns a message indicating what was changed.
      """
  
      obj_type = obj._meta['crits_type']
      message = initial_message
  
      if message is None:
          message = ''
  
      source_filter = None
  
      for changed_field in changed_fields:
  
          # Fields may be fully qualified, e.g. source.1.instances.0.reference
          # So, split on the '.' character and get the root of the changed field
          base_changed_field = MappedMongoFields.get_mapped_mongo_field(obj_type, changed_field.split('.')[0])
  
          new_value = getattr(obj, base_changed_field, '')
          old_obj = class_from_id(obj_type, obj.id)
          old_value = getattr(old_obj, base_changed_field, '')
  
          change_handler = ChangeParser.get_changed_field_handler(obj_type, base_changed_field)
  
          if change_handler is not None:
              change_message = change_handler(old_value, new_value, base_changed_field)
  
              if isinstance(change_message, dict):
                  if change_message.get('source_filter') is not None:
                      new_source_filter = change_message.get('source_filter')
                      source_filter = combine_source_filters(source_filter, new_source_filter)
  
                  change_message = change_message.get('message')
  
              if change_message is not None:
                  message += "\n" + change_message[:1].capitalize() + change_message[1:]
          else:
              change_field_handler = ChangeParser.generic_single_field_change_handler
  
              if isinstance(old_value, BaseList):
  
                  list_value = None
  
                  if len(old_value) > 0:
                      list_value = old_value[0]
                  elif len(new_value) > 0:
                      list_value = new_value[0]
  
                  if isinstance(list_value, basestring):
                      change_field_handler = ChangeParser.generic_list_change_handler
                  elif isinstance(list_value, EmbeddedDocument):
                      change_field_handler = ChangeParser.generic_list_json_change_handler
  
              change_message = change_field_handler(old_value, new_value, base_changed_field)
  
              if isinstance(change_message, dict):
                  if change_message.get('source_filter') is not None:
                      new_source_filter = change_message.get('source_filter')
                      combine_source_filters(source_filter, new_source_filter)
  
                  change_message = change_message.get('message')
  
              if change_message is not None:
                  message += "\n" + change_message[:1].capitalize() + change_message[1:]
  
      return {'message': message, 'source_filter': source_filter}
function_tokens: def process_changed_fields ( initial_message , changed_fields , obj ) : obj_type = obj . _meta [ 'crits_type' ] message = initial_message if message is None : message = '' source_filter = None for changed_field in changed_fields : # Fields may be fully qualified, e.g. source.1.instances.0.reference # So, split on the '.' character and get the root of the changed field base_changed_field = MappedMongoFields . get_mapped_mongo_field ( obj_type , changed_field . split ( '.' ) [ 0 ] ) new_value = getattr ( obj , base_changed_field , '' ) old_obj = class_from_id ( obj_type , obj . id ) old_value = getattr ( old_obj , base_changed_field , '' ) change_handler = ChangeParser . get_changed_field_handler ( obj_type , base_changed_field ) if change_handler is not None : change_message = change_handler ( old_value , new_value , base_changed_field ) if isinstance ( change_message , dict ) : if change_message . get ( 'source_filter' ) is not None : new_source_filter = change_message . get ( 'source_filter' ) source_filter = combine_source_filters ( source_filter , new_source_filter ) change_message = change_message . get ( 'message' ) if change_message is not None : message += "\n" + change_message [ : 1 ] . capitalize ( ) + change_message [ 1 : ] else : change_field_handler = ChangeParser . generic_single_field_change_handler if isinstance ( old_value , BaseList ) : list_value = None if len ( old_value ) > 0 : list_value = old_value [ 0 ] elif len ( new_value ) > 0 : list_value = new_value [ 0 ] if isinstance ( list_value , basestring ) : change_field_handler = ChangeParser . generic_list_change_handler elif isinstance ( list_value , EmbeddedDocument ) : change_field_handler = ChangeParser . generic_list_json_change_handler change_message = change_field_handler ( old_value , new_value , base_changed_field ) if isinstance ( change_message , dict ) : if change_message . get ( 'source_filter' ) is not None : new_source_filter = change_message . get ( 'source_filter' ) combine_source_filters ( source_filter , new_source_filter ) change_message = change_message . get ( 'message' ) if change_message is not None : message += "\n" + change_message [ : 1 ] . capitalize ( ) + change_message [ 1 : ] return { 'message' : message , 'source_filter' : source_filter }