20 from builtins
import str
21 from builtins
import object
28 def process(self, data_set, value_if_granted, value_else):
29 if self.grants(data_set):
30 return value_if_granted
37 if config_files
is None:
39 '/etc/smolt/client.cfg',
40 os.path.expanduser(
'~/.smolt/client.cfg'),
42 self.
config = configparser.ConfigParser()
46 assert 2 <= len(args) <= 3
51 self, distro, data_set = args
52 res = self.
_grants(distro, data_set)
53 logging.debug(
'Section "%s", key "%s" --> "%s"' % (distro, data_set, str(res)))
58 return self.
config.getboolean(distro, data_set)
60 configparser.NoOptionError,
61 configparser.NoSectionError):
70 >>> gate = _FakeGate(grant=True)
71 >>> gate.grants("whatever")
73 >>> gate = _FakeGate(grant=False)
74 >>> gate.grants("whatever")
88 return _Gate([filename, ])
93 >>> create_passing_gate().grants("whatever")
101 >>> create_blocking_gate().grants("whatever")