示例#1
0
 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" })
示例#2
0
 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 ] })
示例#3
0
 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 })
示例#4
0
 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])
示例#5
0
    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"])
示例#6
0
    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"])
示例#7
0
 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])
示例#8
0
 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])
示例#9
0
 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])
示例#10
0
 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])
示例#11
0
 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])
示例#12
0
 def test_empty(self):
     assert self.cmp(tools.convert_configini_values( {} ),
                     {})
示例#13
0
 def test_no_markup(self):
     self.eq_(tools.convert_configini_values({"a": "b"}), {"a": "b"})
示例#14
0
 def test_empty(self):
     self.eq_(tools.convert_configini_values({}), {})
示例#15
0
 def test_no_markup(self):
     assert self.cmp(tools.convert_configini_values( { "a": "b" } ),
                     { "a": "b" })
示例#16
0
 def test_no_markup(self):
     self.eq_(tools.convert_configini_values({"a": "b"}), {"a": "b"})
示例#17
0
 def test_empty(self):
     self.eq_(tools.convert_configini_values({}), {})
示例#18
0
 def checkbadsyntax(d):
     try:
         tools.convert_configini_values( d )
     except tools.ConfigSyntaxErrorException, csee:
         assert True