mirror of https://github.com/fail2ban/fail2ban
BF: In line comments need to specifically enabled in python3.2+
parent
1df634b68b
commit
bff170ec43
|
@ -100,6 +100,7 @@ after = 1.conf
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
kwargs = kwargs.copy()
|
kwargs = kwargs.copy()
|
||||||
kwargs['interpolation'] = BasicInterpolationWithName()
|
kwargs['interpolation'] = BasicInterpolationWithName()
|
||||||
|
kwargs['inline_comment_prefixes'] = ";"
|
||||||
super(SafeConfigParserWithIncludes, self).__init__(
|
super(SafeConfigParserWithIncludes, self).__init__(
|
||||||
*args, **kwargs)
|
*args, **kwargs)
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,18 @@ z = 3%(__name__)s
|
||||||
self.assertEqual(self.c.get('section', 'zz'), 'thesection') # __name__ works even 'delayed'
|
self.assertEqual(self.c.get('section', 'zz'), 'thesection') # __name__ works even 'delayed'
|
||||||
self.assertEqual(self.c.get('section2', 'z'), '3section2') # and differs per section ;)
|
self.assertEqual(self.c.get('section2', 'z'), '3section2') # and differs per section ;)
|
||||||
|
|
||||||
|
def testComments(self):
|
||||||
|
self.assertFalse(self.c.read('g')) # nothing is there yet
|
||||||
|
self._write("g.conf", value=None, content="""
|
||||||
|
[DEFAULT]
|
||||||
|
# A comment
|
||||||
|
b = a
|
||||||
|
c = d ;in line comment
|
||||||
|
""")
|
||||||
|
self.assertTrue(self.c.read('g'))
|
||||||
|
self.assertEqual(self.c.get('DEFAULT', 'b'), 'a')
|
||||||
|
self.assertEqual(self.c.get('DEFAULT', 'c'), 'd')
|
||||||
|
|
||||||
class JailReaderTest(unittest.TestCase):
|
class JailReaderTest(unittest.TestCase):
|
||||||
|
|
||||||
def testIncorrectJail(self):
|
def testIncorrectJail(self):
|
||||||
|
|
Loading…
Reference in New Issue