示例#1
0
文件: confcmd.py 项目: bport/yokadi
 def do_c_get(self, line):
     parser = self.parser_c_get()
     args = parser.parse_args(line)
     key = args.key
     if not key:
         key = "%"
     k = Config.select(AND(LIKE(Config.q.name, key), Config.q.system == args.system))
     fields = [(x.name, "%s (%s)" % (x.value, x.desc)) for x in k]
     if fields:
         tui.renderFields(fields)
     else:
         raise YokadiException("Configuration key %s does not exist" % line)
示例#2
0
文件: confcmd.py 项目: bport/yokadi
 def do_c_get(self, line):
     parser = self.parser_c_get()
     args = parser.parse_args(line)
     key = args.key
     if not key:
         key = "%"
     k = Config.select(
         AND(LIKE(Config.q.name, key), Config.q.system == args.system))
     fields = [(x.name, "%s (%s)" % (x.value, x.desc)) for x in k]
     if fields:
         tui.renderFields(fields)
     else:
         raise YokadiException("Configuration key %s does not exist" % line)
示例#3
0
文件: confcmd.py 项目: bport/yokadi
 def do_c_set(self, line):
     """Set a configuration key to value : c_set <key> <value>"""
     line = line.split()
     if len(line) < 2:
         raise BadUsageException("You should provide two arguments : the parameter key and the value")
     name = line[0]
     value = " ".join(line[1:])
     p = Config.select(AND(Config.q.name == name, Config.q.system == False))
     if p.count() == 0:
         tui.error("Sorry, no parameter match")
     else:
         if self.checkParameterValue(name, value):
             p[0].value = value
             tui.info("Parameter updated")
         else:
             tui.error("Parameter value is incorrect")
示例#4
0
文件: confcmd.py 项目: bport/yokadi
 def do_c_set(self, line):
     """Set a configuration key to value : c_set <key> <value>"""
     line = line.split()
     if len(line) < 2:
         raise BadUsageException(
             "You should provide two arguments : the parameter key and the value"
         )
     name = line[0]
     value = " ".join(line[1:])
     p = Config.select(AND(Config.q.name == name, Config.q.system == False))
     if p.count() == 0:
         tui.error("Sorry, no parameter match")
     else:
         if self.checkParameterValue(name, value):
             p[0].value = value
             tui.info("Parameter updated")
         else:
             tui.error("Parameter value is incorrect")