Przeglądaj źródła

dict_of_key_value_pairs() should not split on colons.

Mike Naberezny 15 lat temu
rodzic
commit
2b50be2117

+ 3 - 3
CHANGES.txt

@@ -10,9 +10,9 @@ Next release
     
       environment=HOME=/home/auser
 
-    Alphanumeric characters, "_", "/", ".", "+", "-", "(", and ")" can all be
-    used as a value without quoting. If any other characters are needed in the
-    value, please quote it as in the first example above.  Thanks to Paul 
+    Alphanumeric characters, "_", "/", ".", "+", "-", "(", ")", and ":" can all 
+    be used as a value without quoting. If any other characters are needed in 
+    the value, please quote it as in the first example above.  Thanks to Paul 
     Heideman for reporting this issue.
 
   - Supervisor will now look for its config file in locations relative to the

+ 1 - 1
src/supervisor/datatypes.py

@@ -85,7 +85,7 @@ def dict_of_key_value_pairs(arg):
         Quotes can be used to allow commas in the value
     """
     lexer = shlex.shlex(arg)
-    lexer.wordchars += '/.+-()'
+    lexer.wordchars += '/.+-():'
     
     tokens = list(lexer)
     tokens_len = len(tokens)

+ 4 - 2
src/supervisor/tests/test_datatypes.py

@@ -117,8 +117,10 @@ class DatatypesTest(unittest.TestCase):
 
     def test_dict_of_key_value_pairs_handles_unquoted_non_alphanum(self):
         actual = datatypes.dict_of_key_value_pairs(
-            'HOME=/home/auser,FOO=/.foo+(1.2)-_/')
-        expected = {'HOME': '/home/auser', 'FOO': '/.foo+(1.2)-_/'}
+            'HOME=/home/auser,FOO=/.foo+(1.2)-_/,'
+            'SUPERVISOR_SERVER_URL=http://127.0.0.1:9001')
+        expected = {'HOME': '/home/auser', 'FOO': '/.foo+(1.2)-_/',
+                    'SUPERVISOR_SERVER_URL': 'http://127.0.0.1:9001'}
         self.assertEqual(actual, expected)
 
     def test_dict_of_key_value_pairs_allows_trailing_comma(self):