def create_value(self, label, vtype=None, lang=None, description=None, unit=None, data=None): """ If vtype is not specified then the value (lang, description & unit are ignored) data can be specified on it's own """ label = Validation.label_check_convert(label) if vtype is not None: vtype = Validation.value_type_check_convert(vtype) lang = Validation.lang_check_convert(lang, allow_none=True) description = Validation.comment_check_convert(description, allow_none=True) unit = unit if vtype is None and data is None: raise AttributeError("create_value with no vtype and no data!") with self.lock: try: value = self.__values[label] except KeyError: value = self.__values[label] = {} if vtype is not None: new_value = {VTYPE: vtype, LANG: lang, DESCRIPTION: description, UNIT: unit} if new_value != value: value.update(new_value) if VALUE + label not in self._changes: logger.debug('Value %s has changed', label) self._changes.append(VALUE + label) if data is not None: value[SHAREDATA] = data if VALUESHARE + label not in self._changes: logger.debug('Sharing value data for %s', label) self._changes.append(VALUESHARE + label)