Пример #1
0
 def do_set(self, args):
     argstrs = args.split()
     try:
         if len(argstrs) == 0:
             conf = config.get_conf()
             for s in conf.keys():
                 for n in conf[s].keys():
                     print ("%s.%s = %s" % (s, n, conf[s][n]))
         elif len(argstrs) == 1:
             r = re.compile("(.+)\.(.+)")
             m = r.match(argstrs[0])
             if m is None or len(m.groups()) != 2:
                 print ("Invalid option format")
                 self.help_set()
                 return
             print ("%s.%s = %s" % (m.group(1), m.group(2),
                                    config.get_value(m.group(1),
                                                     m.group(2))))
         elif len(argstrs) == 2:
             r = re.compile("(.+)\.(.+)")
             m = r.match(argstrs[0])
             if m is None or len(m.groups()) != 2:
                 print ("Invalid option format")
                 self.help_set()
                 return
             config.set_value(m.group(1), m.group(2), argstrs[1])
         else:
             self.help_set()
     except Exception as e:
         self.error(e)
Пример #2
0
 def do_set(self, args):
     argstrs = args.split()
     try:
         if len(argstrs) == 0:
             conf = config.get_conf()
             for s in conf.keys():
                 for n in conf[s].keys():
                     print "%s.%s = %s" % (s, n, conf[s][n])
         elif len(argstrs) == 1:
             r = re.compile("(.+)\.(.+)")
             m = r.match(argstrs[0])
             if m is None or len(m.groups()) != 2:
                 print "Invalid option format"
                 self.help_set()
                 return
             print "%s.%s = %s" % (m.group(1), m.group(2),
                                   config.get_value(m.group(1), m.group(2)))
         elif len(argstrs) == 2:
             r = re.compile("(.+)\.(.+)")
             m = r.match(argstrs[0])
             if m is None or len(m.groups()) != 2:
                 print "Invalid option format"
                 self.help_set()
                 return
             config.set_value(m.group(1), m.group(2), argstrs[1])
         else:
             self.help_set()
     except Exception, e:
         self.error(e)
Пример #3
0
def set_xsel(config, OSX):
    if not OSX:
        xselpath = which("xsel")
        config.set_value("Global", "xsel", xselpath)
    elif OSX:
        pbcopypath = which("pbcopy")
        config.set_value("Global", "xsel", pbcopypath)
Пример #4
0
    def __init__(self, dbver=None, filename=None):
        config.set_defaults(default_config)
        if not OSX:
            self.xselpath = which("xsel")
            config.set_value("Global", "xsel", self.xselpath)
        else:
            self.xselpath = "xsel"

        self.dbver = dbver
        self.filename = filename
Пример #5
0
 def tearDown(self):
     config.set_value('Database', 'filename', self.fname)
     default_config['Database']['filename'] = self.fname1
     config._conf['Database']['filename'] = self.fname
Пример #6
0
 def test_no_algorithm(self):
     config.set_value('Encryption', 'algorithm', '')
     self.assertRaises((CryptoException,), CryptoEngine)
 def test_no_algorithm(self):
     CryptoEngine._instance_new = None
     config.set_value('Encryption', 'algorithm', '')
     self.assertRaises((CryptoException,), CryptoEngine.get)
     config.set_value('Encryption', 'algorithm', 'AES')
Пример #8
0
 def test_no_algorithm(self):
     CryptoEngine._instance_new = None
     config.set_value('Encryption', 'algorithm', '')
     self.assertRaises((CryptoException, ), CryptoEngine.get)
     config.set_value('Encryption', 'algorithm', 'AES')
Пример #9
0
def set_algorithm(args, config):
    if args.algo:
        config.set_value("Encryption", "algorithm", args.algo)
        config.set_value("Global", "save", "False")
Пример #10
0
def set_db(args):
    if args.dbase:
        config.set_value("Database", "filename", args.dbase)
        config.set_value("Global", "save", "False")