Custom save method
767913
def save(self, *args, **kwargs):
        
        # fill name and email
        if self.user:
            self.from_name = self.user.get_full_name()
            self.from_email = self.user.email

        # if not sent yet
        if int(self.status) < 1:
            # tries sending email (will modify self.status!)
            self.send()

        # save in the database unless logging is explicitly turned off in the settings file
        if INWARD_LOG:
            super(Inward, self).save(*args, **kwargs)
882829
def save_load_result(func):
    """"""
    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        """
        Default behavior is no saving and loading. Specify save_name to save
        and load.

        Parameters
        ----------
        save_name: str, optional
            File name including directory and excluding extension.
        save: bool, optional
            Whether or not to save.
        load: bool, optional
            Whether or not to load.
        overwrite existing: bool, optional
            When the save path already contains file: if True, file will be
            overwritten, if False the data will be saved with the system time
            appended to the file name.
        warn_if_error: bool, optional
            Whether or not to issue UserWarning if load=True and save_name
            is not None but there is an error loading.

        Returns
        -------
        Result
            func output.
        """
        save_name = kwargs.pop('save_name', None)
        save = kwargs.pop('save', save_name is not None)
        load = kwargs.pop('load', save_name is not None)
        overwrite_existing = kwargs.pop('overwrite_existing', True)
        warn_if_error = kwargs.pop('warn_if_error', False)
        if load:
            if save_name is None:
                warnings.warn(
                    ('{} has load=True but cannot load because '
                     'save_name=None'.format(func.__name__)),
                    UserWarning)
            else:
                try:
                    return pickle_load(save_name)
                except (OSError, IOError) as err:
                    if warn_if_error:
                        msg = ('{} had {} loading file {}.'.format(
                            func.__name__, type(err).__name__, save_name))
                        msg = ' Continuing without loading.'
                        warnings.warn(msg, UserWarning)
        result = func(*args, **kwargs)
        if save:
            if save_name is None:
                warnings.warn((func.__name__ + ' has save=True but cannot ' +
                               'save because save_name=None'), UserWarning)
            else:
                pickle_save(result, save_name,
                            overwrite_existing=overwrite_existing)
        return result
    return wrapper
756137
def pre_save(self, model_instance, add):
        """"""
        value = super().pre_save(model_instance, add)
        if isinstance(value, LocalizedValue):
            for file in value.__dict__.values():
                if file and not file._committed:
                    file.save(file.name, file, save=False)
        return value
920784
def save_wrapper(cls, save, new_class):
        
        def _wrapped(self, *args, **kwargs):
            if not self.installed:
                raise AssertionError('Module %s is not installed' %
                                     self.verbose_name)

            logger.info("Saving %s module" % self.verbose_name)
            pre_save.send(sender=self)
            res = save(self, *args, **kwargs)
            post_save.send(sender=self)
            logger.info("Saved %s module" % self.verbose_name)

            return res

        return _wrapped
64958
def save(self, *args):
        """"""
        if self.name_wid is None or self.store is None:
            Logger.debug("{}: Not saving, missing name_wid or store".format(type(self).__name__))
            return
        if not (self.name_wid.text or self.name_wid.hint_text):
            Logger.debug("{}: Not saving, no name".format(type(self).__name__))
            return
        if self.name_wid.text and self.name_wid.text[0] in string.digits + string.whitespace + string.punctuation:
            # TODO alert the user to invalid name
            Logger.warning("{}: Not saving, invalid name".format(type(self).__name__))
            return
        if hasattr(self, '_do_parse'):
            try:
                parse(self.source)
            except SyntaxError:
                # TODO alert user to invalid source
                Logger.debug("{}: Not saving, couldn't parse".format(type(self).__name__))
                return
        do_redata = False
        if self.name_wid.text:
            if (
                self.name_wid.hint_text and
                self.name_wid.hint_text != self.name_wid.text and
                hasattr(self.store, self.name_wid.hint_text)
            ):
                delattr(self.store, self.name_wid.hint_text)
                do_redata = True
            if (
                not hasattr(self.store, self.name_wid.text) or
                getattr(self.store, self.name_wid.text) != self.source
            ):
                Logger.debug("{}: Saving!".format(type(self).__name__))
                setattr(self.store, self.name_wid.text, self.source)
                do_redata = True
        elif self.name_wid.hint_text:
            if (
                not hasattr(self.store, self.name_wid.hint_text) or
                getattr(self.store, self.name_wid.hint_text) != self.source
            ):
                Logger.debug("{}: Saving!".format(type(self).__name__))
                setattr(self.store, self.name_wid.hint_text, self.source)
                do_redata = True
        return do_redata
1087051
def save(opts={})
    options = { :validate => true }.merge(opts)
    return false if !(new_record? || changed?)
    if options[:validate]
      return false if !valid?
    end
    begin
      save!(options)
    rescue
      return false
    end
    true
  end
7307
def save(self, obj):
        """"""
        cur = self._conn().cursor()

        tabname = obj.__class__.get_table_name()

        index_names = obj.__class__.index_names() or []

        col_names = ['id', 'value'] + index_names
        value_holders = ['%s'] * len(col_names)
        updates = ['%s = EXCLUDED.%s' % (cn, cn) for cn in col_names[1:]]

        if not obj.id:
            id = uuid()
            obj.id = id

        query = 'insert into {0} ({1}) values ({2}) on conflict(id) do update set {3};'.format(
            tabname,
            ','.join(col_names),
            ','.join(value_holders),
            ','.join(updates),
        )

        values = [obj.id, obj.to_data()]

        index_vals = obj.indexes() or {}
        values += [index_vals.get(name, 'NULL') for name in index_names]

        with self._conn() as conn:
            with conn.cursor() as cur:
                cur.execute(query, tuple(values))
205138
def save!
      object = self.class.name.split("::").last.downcase
      data = {}

      self.class.accessor_properties.each do |property|
        data[property] = instance_variable_get "@#{property}"
      end

      API.send("update_#{object}", @id, data)
    end
1059505
public function save() {
        $configdata = $this->get('configdata');
        if (!array_key_exists('defaultvalue_editor', $configdata)) {
            $this->field->save();
            return;
        }

        if (!$this->get('id')) {
            $this->field->save();
        }

        // Store files.
        $textoptions = $this->value_editor_options();
        $tempvalue = (object) ['defaultvalue_editor' => $configdata['defaultvalue_editor']];
        $tempvalue = file_postupdate_standard_editor($tempvalue, 'defaultvalue', $textoptions, $textoptions['context'],
            'customfield_textarea', 'defaultvalue', $this->get('id'));

        $configdata['defaultvalue'] = $tempvalue->defaultvalue;
        $configdata['defaultvalueformat'] = $tempvalue->defaultvalueformat;
        unset($configdata['defaultvalue_editor']);
        $this->field->set('configdata', json_encode($configdata));
        $this->field->save();
    }
1188824
def save_object(self, obj):
        
        obj.save()
        try:
            save_object(obj, editor=self)
        except DisciplineException:
            pass
1133788
def saveit(func):
    """"""

    name = '_' + func.__name__

    def _wrapper(self, *args, **kwds):
        if not hasattr(self, name):
            setattr(self, name, func(self, *args, **kwds))
        return getattr(self, name)
    return _wrapper
924417
def save(self, **kwargs):
        """"""
        try:
            return super().save(**kwargs)
        except SlugError as error:
            raise ParseError(error)
1352403
def save(coll, to_save):
	
	filter = Projection(['_id'], to_save)
	upsert_replace = functools.partial(coll.replace_one, filter, upsert=True)
	op = upsert_replace if filter else coll.insert_one
	return op(to_save)
516824
def save(self, *args, **kwargs):
        
        custom_checks = kwargs.pop('custom_checks', True)

        super(Device, self).save(*args, **kwargs)

        if custom_checks is False:
            return

        changed = False

        if not self.location:
            self.location = self.node.point
            changed = True

        if not self.elev and self.node.elev:
            self.elev = self.node.elev
            changed = True

        original_user = self.shortcuts.get('user')

        if self.node.user:
            self.shortcuts['user'] = self.node.user

        if original_user != self.shortcuts.get('user'):
            changed = True

        if 'nodeshot.core.layers' in settings.INSTALLED_APPS:
            original_layer = self.shortcuts.get('layer')
            self.shortcuts['layer'] = self.node.layer

            if original_layer != self.shortcuts.get('layer'):
                changed = True

        if changed:
            self.save(custom_checks=False)
7101
public static function save()
	{
		// storage for arguments
		$path = null;
		$ids = array();

		// do we have any arguments
		if (func_num_args())
		{
			// process them
			foreach (func_get_args() as $arg)
			{
				if (is_string($arg))
				{
					$path = $arg;
				}
				elseif(is_numeric($arg))
				{
					in_array($arg, $ids) or $ids[] = $arg;
				}
				elseif(is_array($arg))
				{
					$ids = array_merge($ids, $arg);
				}
			}
		}

		// now process the files
		$counter = 0;
		foreach (static::$upload->getValidFiles() as $file)
		{
			// do we want to process this file?
			if ( ! empty($ids) and ! in_array($counter++, $ids))
			{
				// nope
				continue;
			}

			// was a custom path defined?
			$path and $file->setConfig('path', $path);

			// save the file
			$file->save();
		}
	}
414543
def save
        if @system_data and (something = @system_data[:client]) and something.respond_to?(:attributes)
          changes = 0
          something.attributes.each do |k, v|
            if self.send(k) != v
              something.send(k + '=', self.send(k))
              changes += 1
            end
          end
          something.save if changes > 0
        else
          raise TaskMapper::Exception.new("#{self.class.name}::#{this_method} method must be implemented by the provider")
        end
      end
764690
def saveCustomData(self, data):
        
        LOGGER.info('Sending customData to Polyglot.')
        message = { 'customdata': data }
        self.send(message)