# HG changeset patch # User Franz Glasner # Date 1620376521 -7200 # Node ID a04cd5dbcd2ca4a6fc0e766ebc1d26cc4bdd8db0 # Parent 5ec0ae3bb8dbb2a3b35971394ab8adb8254e12e0 By default quote also the characters "{", "}", "[" and "]" because they are special in YAML diff -r 5ec0ae3bb8db -r a04cd5dbcd2c configmix/config.py --- a/configmix/config.py Fri May 07 09:31:22 2021 +0200 +++ b/configmix/config.py Fri May 07 10:35:21 2021 +0200 @@ -387,7 +387,7 @@ characters unicode codepoint value. Handled are the important special chars: ``%``, ``.``, ``:``, - ``#``; ``'``, ``"`` and ``|``. + ``#``; ``'``, ``"``, ``|``, ``{``, ``}``, ``[`` and ``]``. See also the :ref:`quoting` section. @@ -399,7 +399,11 @@ s = s.replace(klass._COMMENT, qc + "x23") s = s.replace(klass._FILTER_SEPARATOR, qc + "x7c") s = s.replace('"', qc + "x22") - return s.replace("'", qc + "x27") + s = s.replace("'", qc + "x27") + s = s.replace('{', qc + "x7b") + s = s.replace('}', qc + "x7d") + s = s.replace('[', qc + "x5b") + return s.replace(']', qc + "x5d") @classmethod def unquote(klass, s): diff -r 5ec0ae3bb8db -r a04cd5dbcd2c tests/test.py --- a/tests/test.py Fri May 07 09:31:22 2021 +0200 +++ b/tests/test.py Fri May 07 10:35:21 2021 +0200 @@ -782,7 +782,8 @@ self._cfg.getvar_s("events.qc-2021%x2e1-5G-summit.xref.%x23")) def test_quoting_and_unquoting_are_inverse(self): - for c in """abc09'"#:|%./""": + for c in """abc09'"#:|%.{}[]/""": + print c self.assertEqual(c, self._cfg.unquote(self._cfg.quote(c))) def test_namespace_quoting(self):