Update a case.
        :param case: The case to update. The case's `id` determines which case to update.
        :param fields: Optional parameter, an array of fields names, the ones we want to update
        :return:
167522
def update_case(self, case, fields=[]):
        
        req = self.url + "/api/case/{}".format(case.id)

        # Choose which attributes to send
        update_keys = [
            'title', 'description', 'severity', 'startDate', 'owner', 'flag', 'tlp', 'tags', 'status', 'resolutionStatus',
            'impactStatus', 'summary', 'endDate', 'metrics', 'customFields'
        ]
        data = {k: v for k, v in case.__dict__.items() if (len(fields) > 0 and k in fields) or (len(fields) == 0 and k in update_keys)}
        try:
            return requests.patch(req, headers={'Content-Type': 'application/json'}, json=data, proxies=self.proxies, auth=self.auth, verify=self.cert)
        except requests.exceptions.RequestException:
            raise CaseException("Case update error: {}".format(e))
388910
def update_fields(fields)
      attributes[:name]      = fields['name'] || attributes[:name]
      attributes[:id]        = fields['id'] || attributes[:id]
      attributes[:pos]       = fields['pos'] || attributes[:pos]
      attributes[:url]       = fields['url'] || attributes[:url]
      attributes[:bytes]     = fields['bytes'].to_i || attributes[:bytes]
      attributes[:member_id] = fields['idMember'] || attributes[:member_id]
      attributes[:date]      = Time.parse(fields['date']).presence || attributes[:date]
      attributes[:is_upload] = fields['isUpload'] if fields.has_key?('isUpload')
      attributes[:mime_type] = fields['mimeType'] || attributes[:mime_type]
      attributes[:previews]  = fields['previews'] if fields.has_key?('previews')
      self
    end
500806
def update_language_cases
      @cases = parse_language_cases
    
      unless params[:case_action]
        return render(:partial => "edit_cases")
      end
  
      if params[:case_action].index("add_at")
        position = params[:case_action].split("_").last.to_i
        @cases.insert(position, Tr8n::LanguageCase.new(:language => tr8n_current_language))
      elsif params[:case_action].index("delete_at")
        position = params[:case_action].split("_").last.to_i
        @cases.delete_at(position)
      elsif params[:case_action].index("clear_all")
        @cases = []
      end
    
      render :partial => "edit_language_cases"      
    end
828949
def update_profiles(adapter):

    

    for case in adapter.cases():

        #If the case has a vcf_path, get the profiles and update the
        #case with new profiled individuals.
        if case.get('profile_path'):

            profiles = get_profiles(adapter, case['profile_path'])
            profiled_individuals = deepcopy(case['individuals'])

            for individual in profiled_individuals:
                ind_id = individual['ind_id']
                try:
                    profile = profiles[ind_id]
                    individual['profile'] = profile

                except KeyError:
                    LOG.warning(f"sample IDs in vcf does not match for case {case['case_id']}")

            updated_case = deepcopy(case)

            updated_case['individuals'] = profiled_individuals

            adapter.add_case(updated_case, update=True)
1024362
def update_alert(self, alert_id, alert, fields=[]):
        
        req = self.url + "/api/alert/{}".format(alert_id)

        # update only the alert attributes that are not read-only
        update_keys = ['tlp', 'severity', 'tags', 'caseTemplate', 'title', 'description']

        data = {k: v for k, v in alert.__dict__.items() if
                (len(fields) > 0 and k in fields) or (len(fields) == 0 and k in update_keys)}

        if hasattr(alert, 'artifacts'):
            data['artifacts'] = [a.__dict__ for a in alert.artifacts]
        try:
            return requests.patch(req, headers={'Content-Type': 'application/json'}, json=data, proxies=self.proxies, auth=self.auth, verify=self.cert)
        except requests.exceptions.RequestException:
            raise AlertException("Alert update error: {}".format(e))
339967
def add_field(self, field):
        
        field = FieldFactory(
            field,
        )
        field.set_table(self)

        # make sure field is not already added
        field_name = field.get_name()
        for existing_field in self.fields:
            if existing_field.get_name() == field_name:
                return None

        self.before_add_field(field)
        field.before_add()

        if field.ignore is False:
            self.fields.append(field)

        return field
980524
def update_fields_in_record(model, name_or_id, record_field, record_value)
      workitem[PERSIST_META] = true
      workitem[UPDATE_META] = true
      workitem[MODEL_META] = model
      workitem[RECORD_ID_META] = name_or_id.to_s
      workitem[RECORD_FIELD_META] = record_field
      workitem[RECORD_VALUE_META] = record_value

      send_workitem_message

      workitem.delete(PERSIST_META)
      workitem.delete(UPDATE_META)
    end
1290110
def case(self, case_id=None):
        
        cases = self.cases()
        if case_id:
            for case in cases:
                if case.case_id == case_id:
                    return case
        else:
            if cases:
                return cases[0]

        return None
1355470
def update(self, id, **kwargs):
        

        response = self.ghost.execute_put('%s/%s/' % (self._type_name, id), json={
            self._type_name: [
                kwargs
            ]
        })

        return self._model_type(response.get(self._type_name)[0])
1132988
public static function doUpdate(array $options=array(), $instance=null, $IDField=null) {
		self::prepareQuery($options, $instance, $IDField);
		return self::$instances[$instance]->update($options);
	}
22897
def delete_case(self, case_obj):
        
        for ind_obj in case_obj.individuals:
            self.delete_individual(ind_obj)
        logger.info("Deleting case {0} from database".format(case_obj.case_id))
        self.session.delete(case_obj)
        self.save()
        return case_obj
592747
def add_field(self, name, default_value=None):
        """"""
        self._fields[name] = default_value

        def func(cluster):
            return self.get(name, cluster)

        setattr(self, name, func)
1225324
def _update_on_fields(prev_ele, new_ele):
    '''
    
    '''
    fields_update = dict(
        (prop_name, prop_val)
        for prop_name, prop_val in six.iteritems(new_ele)
        if new_ele.get(prop_name) != prev_ele.get(prop_name) or prop_name in _MATCH_KEYS
    )
    if len(set(fields_update.keys()) | set(_MATCH_KEYS)) > len(set(_MATCH_KEYS)):
        if 'id' not in fields_update:
            # in case of update, the ID is necessary
            # if not specified in the pillar,
            # will try to get it from the prev_ele
            fields_update['id'] = prev_ele['id']
        return fields_update
667016
def update(self, *fields):
        
        from mongoframes.queries import to_refs

        assert '_id' in self._document, "Can't update documents without `_id`"

        # Send update signal
        signal('update').send(self.__class__, frames=[self])

        # Check for selective updates
        if len(fields) > 0:
            document = {}
            for field in fields:
                document[field] = self._path_to_value(field, self._document)
        else:
            document = self._document

        # Prepare the document to be updated
        document = to_refs(document)
        document.pop('_id', None)

        # Update the document
        self.get_collection().update_one({'_id': self._id}, {'$set': document})

        # Send updated signal
        signal('updated').send(self.__class__, frames=[self])
327874
def update(self, data=None, **kwargs):
        
        if data is None:
            data = {}
        data.update(kwargs)
        return self.model.write([self.id], data)
96632
def _get_update_fields(model, uniques, to_update):
    
    fields = {
        field.attname: field
        for field in model._meta.fields
    }

    if to_update is None:
        to_update = [
            field.attname for field in model._meta.fields
        ]

    to_update = [
        attname for attname in to_update
        if (attname not in uniques
            and not getattr(fields[attname], 'auto_now_add', False)
            and not fields[attname].auto_created)
    ]

    return to_update
527149
def update_fields
      return true unless params[:fields] 
      params[:fields].each do |id, value|
        field = @post.post_fields.find_by(id: id)
        return false unless field
        return false unless update_field(field, value)
      end
      true
    end