Save a "global".

        The name of this method is somewhat misleading: all types get
        dispatched here.
963384
def save_global(self, obj, name=None, pack=struct.pack):
        
        if obj is type(None):
            return self.save_reduce(type, (None,), obj=obj)
        elif obj is type(Ellipsis):
            return self.save_reduce(type, (Ellipsis,), obj=obj)
        elif obj is type(NotImplemented):
            return self.save_reduce(type, (NotImplemented,), obj=obj)

        if obj.__module__ == "__main__":
            return self.save_dynamic_class(obj)

        try:
            return Pickler.save_global(self, obj, name=name)
        except Exception:
            if obj.__module__ == "__builtin__" or obj.__module__ == "builtins":
                if obj in _BUILTIN_TYPE_NAMES:
                    return self.save_reduce(
                        _builtin_type, (_BUILTIN_TYPE_NAMES[obj],), obj=obj)

            typ = type(obj)
            if typ is not obj and isinstance(obj, (type, types.ClassType)):
                return self.save_dynamic_class(obj)

            raise
219017
def save(self, *args, **kwargs):
        
        self.type = INTERFACE_TYPES.get('ethernet')
        super(Ethernet, self).save(*args, **kwargs)
967249
def remove_global(self, name):
        
        with self._lock:
            if self._gpayload is not None:
                if name in self._gpayload:
                    del self._gpayload[name]
                if not self._gpayload:
                    self._gpayload = None
404995
def save(self):
        """"""

        # first call save with commit=False for all Forms
        for form in self._forms:
            if isinstance(form, BaseForm):
                form.save(commit=False)

        # call save on the instance
        self.instance.save()

        # call any post-commit hooks that have been stashed on Forms
        for form in self.forms:
            if isinstance(form, BaseForm):
                if hasattr(form, 'save_m2m'):
                    form.save_m2m()
                if hasattr(form, 'save_related'):
                    form.save_related()

        # call save on any formsets
        for form in self._forms:
            if isinstance(form, BaseFormSet):
                form.save(commit=True)

        return self.instance
84422
def _ensure_global(self, values=None):
        
        if self._gpayload is None:
            self._gpayload = values or {}
        self.enable()
614852
def save(self, *args, **kwargs):
        
        ignore_default_check = kwargs.pop('ignore_default_check', False)
        # if making this status the default one
        if self.is_default != self._current_is_default and self.is_default is True:
            # uncheck other default statuses first
            for status in self.__class__.objects.filter(is_default=True):
                status.is_default = False
                status.save(ignore_default_check=True)

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

        # in case there are no default statuses, make this one as the default one
        if self.__class__.objects.filter(is_default=True).count() == 0 and not ignore_default_check:
            self.is_default = True
            self.save()
        # update __current_status
        self._current_is_default = self.is_default
1104304
def save(self, *args, **kwargs):
        
        after_save = kwargs.pop('after_save', True)
        super(LayerExternal, self).save(*args, **kwargs)
        # call after_external_layer_saved method of synchronizer
        if after_save:
            try:
                synchronizer = self.synchronizer
            except ImproperlyConfigured:
                pass
            else:
                if synchronizer:
                    synchronizer.after_external_layer_saved(self.config)
        # reload schema
        self._reload_schema()
803266
def save(self, reload=False):
        """"""
        self.wrapper.raw.save()
        if reload:
            self.reload()
1084431
def add_global(self, **values):
        """"""
        with self._lock:
            self._ensure_global()
            self._gpayload.update(**values)
512527
def save(self, *args, **kwargs):
        
        self.modified = timezone.now()
        super(AbstractBaseModel, self).save(*args, **kwargs)
277747
def save_all(self):
        
        initial_index = self.currentIndex()
        for i in range(self.count()):
            try:
                self.setCurrentIndex(i)
                self.save_current()
            except AttributeError:
                pass
        self.setCurrentIndex(initial_index)
184629
def save_global(self, obj, name=None, pack=struct.pack):
        
        if obj.__module__ == "__builtin__" or obj.__module__ == "builtins":
            if obj in _BUILTIN_TYPE_NAMES:
                return self.save_reduce(_builtin_type, (_BUILTIN_TYPE_NAMES[obj],), obj=obj)

        if name is None:
            name = obj.__name__

        modname = getattr(obj, "__module__", None)
        if modname is None:
            try:
                # whichmodule() could fail, see
                # https://bitbucket.org/gutworth/six/issues/63/importing-six-breaks-pickling
                modname = pickle.whichmodule(obj, name)
            except Exception:
                modname = '__main__'

        if modname == '__main__':
            themodule = None
        else:
            __import__(modname)
            themodule = sys.modules[modname]
            self.modules.add(themodule)

        if hasattr(themodule, name) and getattr(themodule, name) is obj:
            return Pickler.save_global(self, obj, name)

        typ = type(obj)
        if typ is not obj and isinstance(obj, (type, _class_type)):
            self.save_dynamic_class(obj)
        else:
            raise pickle.PicklingError("Can't pickle %r" % obj)
642717
@RequestMapping(value = "globals/{type}/{id}", method = RequestMethod.PUT)
    public Ack saveGlobalPermission(@PathVariable PermissionTargetType type, @PathVariable int id, @RequestBody PermissionInput input) {
        return accountService.saveGlobalPermission(type, id, input);
    }
332936
def save(self):
        
        if self.mode in ("wb+", 'rb+'):
            if not self.is_open:
                raise IOError("file closed")
            self.write_reference_properties()
            self.manager.write_objects()
446831
def save(self):
        
        with NamedTemporaryFile(
            dir=os.path.dirname(self.storage_path), delete=False
        ) as f:
            # we use protocol=2 for python 2/3 compatibility
            dump(self.data, f, protocol=2)
            f.flush()
            os.fsync(f.fileno())
            tmppath = f.name
        os.rename(tmppath, self.storage_path)
1318780
def save(self, commit=True):
        
        # set the localised fields
        for localized_field in self.instance.localized_fields:
            setattr(self.instance, localized_field, self.cleaned_data[localized_field])

        return super(LocalisedForm, self).save(commit)
1204765
def save(self, *objects):
        
        if len(objects) > 0:
            self.session.add_all(objects)
        self.session.commit()