示例#1
0
        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
示例#2
0
    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
示例#3
0
文件: repl.py 项目: capc/middleware
        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
示例#4
0
    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
示例#5
0
文件: disks.py 项目: capc/middleware
 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)
示例#6
0
文件: disks.py 项目: capc/middleware
 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)
示例#7
0
    def do_remove(self, obj, value):
        if self.type != ValueType.ARRAY:
            raise ValueError('Property is not an array')

        value = read_value(value, self.type)
示例#8
0
    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))
示例#9
0
    def do_remove(self, obj, value):
        if self.type != ValueType.ARRAY:
            raise ValueError('Property is not an array')

        value = read_value(value, self.type)
示例#10
0
    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))