Browse Source

[1649] remove superfluous / from identifier

Jelte Jansen 13 years ago
parent
commit
b31b7eff36

+ 3 - 0
src/lib/python/isc/config/config_data.py

@@ -651,8 +651,11 @@ class MultiConfigData:
                     entry = _create_value_map_entry(module, 'module', None)
                     result.append(entry)
         else:
+            # Strip off start and end slashes, if they are there
             if identifier[0] == '/':
                 identifier = identifier[1:]
+            if identifier[-1] == '/':
+                identifier = identifier[:-1]
             module, sep, id = identifier.partition('/')
             spec = self.get_module_spec(module)
             if spec:

+ 3 - 0
src/lib/python/isc/config/tests/config_data_test.py

@@ -602,6 +602,9 @@ class TestMultiConfigData(unittest.TestCase):
                    ]
         maps = self.mcd.get_value_maps("/Spec22/value9")
         self.assertEqual(expected, maps)
+        # A slash at the end should not produce different output
+        maps = self.mcd.get_value_maps("/Spec22/value9/")
+        self.assertEqual(expected, maps)
 
     def test_get_value_maps_named_set(self):
         module_spec = isc.config.module_spec_from_file(self.data_path + os.sep + "spec32.spec")