1 from Converter import Converter
2 from Components.Element import cached
4 from Components.config import configfile
6 class ConfigEntryTest(Converter, object):
7 def __init__(self, argstr):
8 Converter.__init__(self, argstr)
9 args = argstr.split(',')
11 self.checkSourceBoolean = False
14 self.configValue = None
18 if args[0].find("config.") != -1:
19 self.configKey = args[0]
20 self.configValue = args[1]
22 if args[2] == 'Invert':
24 elif args[2] == 'CheckSourceBoolean':
25 self.checkSourceBoolean = True
29 if args[3] == 'Invert':
31 elif args[3] == 'CheckSourceBoolean':
32 self.checkSourceBoolean = True
38 print "ConfigEntryTest Converter got incorrect arguments", args, "!!!\narg[0] must start with 'config.',\narg[1] is the compare string,\narg[2],arg[3] are optional arguments and must be 'Invert' or 'CheckSourceBoolean'"
43 print "ConfigEntryTest got invalid arguments", self.converter_arguments, "force True!!"
45 if self.checkSourceBoolean and not self.source.boolean:
47 val = configfile.getResolvedKey(self.configKey)
48 ret = val == self.configValue
49 return ret ^ self.invert
51 boolean = property(getBoolean)