diff --git a/supysonic/config.py b/supysonic/config.py index c70f8f1..4394a60 100644 --- a/supysonic/config.py +++ b/supysonic/config.py @@ -10,9 +10,9 @@ # Distributed under terms of the GNU AGPLv3 license. try: - from configparser import ConfigParser + from configparser import RawConfigParser except ImportError: - from ConfigParser import SafeConfigParser as ConfigParser + from ConfigParser import RawConfigParser import os import tempfile @@ -55,7 +55,7 @@ class IniConfig(DefaultConfig): ] def __init__(self, paths): - parser = ConfigParser() + parser = RawConfigParser() parser.read(paths) for section in parser.sections(): diff --git a/tests/assets/sample.ini b/tests/assets/sample.ini index 065ee46..d2356ce 100644 --- a/tests/assets/sample.ini +++ b/tests/assets/sample.ini @@ -11,3 +11,7 @@ switch_true = on yn_false = no yn_true = yes +[issue84] +variable = value +key = some value with a %variable + diff --git a/tests/base/test_config.py b/tests/base/test_config.py index 8165175..c357630 100644 --- a/tests/base/test_config.py +++ b/tests/base/test_config.py @@ -4,7 +4,7 @@ # This file is part of Supysonic. # Supysonic is a Python implementation of the Subsonic server API. # -# Copyright (C) 2017 Alban 'spl0k' Féron +# Copyright (C) 2017-2018 Alban 'spl0k' Féron # # Distributed under terms of the GNU AGPLv3 license. @@ -32,6 +32,12 @@ class ConfigTestCase(unittest.TestCase): self.assertFalse(conf.BOOLEANS[t + '_false']) self.assertTrue(conf.BOOLEANS[t + '_true']) + def test_no_interpolation(self): + conf = IniConfig('tests/assets/sample.ini') + + self.assertEqual(conf.ISSUE84['variable'], 'value') + self.assertEqual(conf.ISSUE84['key'], 'some value with a %variable') + if __name__ == '__main__': unittest.main()