def test_strings(self): assert self.cmp(tools.convert_configini_values( { "a": "'b'" } ), { "a": "b" }) assert self.cmp(tools.convert_configini_values( { "a": "\"b\"" } ), { "a": "b" }) assert self.cmp(tools.convert_configini_values( { "a": " \"b\" " } ), { "a": "b" })
def test_lists(self): assert self.cmp(tools.convert_configini_values( { "a": "[]" } ), { "a": [ ] }) assert self.cmp(tools.convert_configini_values( { "a": "[1]" } ), { "a": [ 1 ] }) assert self.cmp(tools.convert_configini_values( { "a": "[1, 2]" } ), { "a": [ 1, 2 ] }) assert self.cmp(tools.convert_configini_values( { "a": " [1 ,2 , 3] " } ), { "a": [ 1, 2, 3 ] }) assert self.cmp(tools.convert_configini_values( { "a": "['1' ,\"2\" , 3]" } ), { "a": [ "1", "2", 3 ] })
def test_integers(self): assert self.cmp(tools.convert_configini_values( { "a": "1" } ), { "a": 1 }) assert self.cmp(tools.convert_configini_values( { "a": "1", "b": "2" } ), { "a": 1, "b": 2 }) assert self.cmp(tools.convert_configini_values( { "a": "10" } ), { "a": 10 }) assert self.cmp(tools.convert_configini_values( { "a": "100" } ), { "a": 100 }) assert self.cmp(tools.convert_configini_values( { "a": " 100 " } ), { "a": 100 })
def test_strings(self): for mem in (({"a": "'b'"}, {"a": "b"}), ({"a": "\"b\""}, {"a": "b"}), ({"a": " \"b\" "}, {"a": "b"}), ({"a": "español"}, {"a": "español"}), ({"a": "'español'"}, {"a": "español"})): self.eq_(tools.convert_configini_values(mem[0]), mem[1])
def __init__(self, environ=None, start_response=None, configini=None): """ Make WSGI app for Pyblosxom. :param environ: FIXME :param start_response: FIXME :param configini: Dict encapsulating information from a ``config.ini`` file or any other property file that will override the ``config.py`` file. """ self.environ = environ self.start_response = start_response if configini == None: configini = {} _config = tools.convert_configini_values(configini) import config self.config = dict(config.py) self.config.update(_config) if "codebase" in _config: sys.path.insert(0, _config["codebase"])
def __init__(self, environ=None, start_response=None, configini=None): """ Make WSGI app for Pyblosxom. :param environ: FIXME :param start_response: FIXME :param configini: Dict encapsulating information from a ``config.ini`` file or any other property file that will override the ``config.py`` file. """ self.environ = environ self.start_response = start_response if configini is None: configini = {} _config = tools.convert_configini_values(configini) import config self.config = dict(config.py) self.config.update(_config) if "codebase" in _config: sys.path.insert(0, _config["codebase"])
def test_lists(self): for mem in (({"a": "[]"}, {"a": []}), ({"a": "[1]"}, {"a": [1]}), ({"a": "[1, 2]"}, {"a": [1, 2]}), ({"a": " [1 ,2 , 3]"}, {"a": [1, 2, 3]}), ({"a": "['1' ,\"2\" , 3]"}, {"a": ["1", "2", 3]})): self.eq_(tools.convert_configini_values(mem[0]), mem[1])
def test_integers(self): for mem in (({"a": "1"}, {"a": 1}), ({"a": "1", "b": "2"}, {"a": 1, "b": 2}), ({"a": "10"}, {"a": 10}), ({"a": "100"}, {"a": 100}), ({"a": " 100 "}, {"a": 100})): self.eq_(tools.convert_configini_values(mem[0]), mem[1])
def test_lists(self): for mem in ( ({"a": "[]"}, {"a": []}), ({"a": "[1]"}, {"a": [1]}), ({"a": "[1, 2]"}, {"a": [1, 2]}), ({"a": " [1 ,2 , 3]"}, {"a": [1, 2, 3]}), ({"a": "['1' ,\"2\" , 3]"}, {"a": ["1", "2", 3]}), ): self.eq_(tools.convert_configini_values(mem[0]), mem[1])
def test_strings(self): for mem in ( ({"a": "'b'"}, {"a": "b"}), ({"a": '"b"'}, {"a": "b"}), ({"a": ' "b" '}, {"a": "b"}), ({"a": "español"}, {"a": "español"}), ({"a": "'español'"}, {"a": "español"}), ): self.eq_(tools.convert_configini_values(mem[0]), mem[1])
def test_integers(self): for mem in ( ({"a": "1"}, {"a": 1}), ({"a": "1", "b": "2"}, {"a": 1, "b": 2}), ({"a": "10"}, {"a": 10}), ({"a": "100"}, {"a": 100}), ({"a": " 100 "}, {"a": 100}), ): self.eq_(tools.convert_configini_values(mem[0]), mem[1])
def test_empty(self): assert self.cmp(tools.convert_configini_values( {} ), {})
def test_no_markup(self): self.eq_(tools.convert_configini_values({"a": "b"}), {"a": "b"})
def test_empty(self): self.eq_(tools.convert_configini_values({}), {})
def test_no_markup(self): assert self.cmp(tools.convert_configini_values( { "a": "b" } ), { "a": "b" })
def test_no_markup(self): self.eq_(tools.convert_configini_values({"a": "b"}), {"a": "b"})
def test_empty(self): self.eq_(tools.convert_configini_values({}), {})
def checkbadsyntax(d): try: tools.convert_configini_values( d ) except tools.ConfigSyntaxErrorException, csee: assert True