def set(self, value): value = read_value(value, self.type) if self.choices is not None and value not in self.choices: raise ValueError( _("Value not on the list of possible choices")) self.value = value
def do_set(self, obj, value): value = read_value(value, self.type) if callable(self.set): self.set(obj, value) return obj[self.set] = value
def run(self, context, args, kwargs, opargs): erase_data = read_value(kwargs.pop('wipe', 'no'), ValueType.BOOLEAN) context.submit_task('disks.erase', self.parent.entity['path'], erase_data)
def do_remove(self, obj, value): if self.type != ValueType.ARRAY: raise ValueError('Property is not an array') value = read_value(value, self.type)
def do_append(self, obj, value): if self.type != ValueType.ARRAY: raise ValueError('Property is not an array') value = read_value(value, self.type) self.set(obj, self.get(obj).append(value))