def setm(self, base, sub, value): """ Set the value of multiple nodes in one operation. Find or create a node matching `sub` by interpreting `sub` as a path expression relative to each node matching `base`. `sub` may be :py:obj:`None`, in which case all the nodes matching `base` will be modified. """ # Sanity checks if type(base) != str: raise TypeError("base MUST be a string!") if type(sub) != str and sub is not None: raise TypeError("sub MUST be a string or None!") if type(value) != str and value is not None: raise TypeError("value MUST be a string or None!") if not self.__handle: raise RuntimeError("The Augeas object has already been closed!") # Call the function ret = lib.aug_setm( self.__handle, enc(base), enc(sub), enc(value)) if ret < 0: self._raise_error(AugeasValueError, "Augeas.setm() failed") return ret
def setm(self, base, sub, value): """Set the value of multiple nodes in one operation. Find or create a node matching 'sub' by interpreting 'sub' as a path expression relative to each node matching 'base'. 'sub' may be None, in which case all the nodes matching 'base' will be modified.""" # Sanity checks if type(base) != str: raise TypeError("base MUST be a string!") if type(sub) != str and sub != None: raise TypeError("sub MUST be a string or None!") if type(value) != str and value != None: raise TypeError("value MUST be a string or None!") if not self.__handle: raise RuntimeError("The Augeas object has already been closed!") # Call the function ret = lib.aug_setm(self.__handle, enc(base), enc(sub), enc(value)) if ret < 0: raise ValueError("Unable to set value to path!") return ret