BIND 10 trac1649, updated. bbd3fd0f48b0f20174ad7fb75ff1ba75c4bd2731 [1649] one more check, and doc update
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Feb 14 17:28:58 UTC 2012
The branch, trac1649 has been updated
via bbd3fd0f48b0f20174ad7fb75ff1ba75c4bd2731 (commit)
from c70cfef4856f2df56349d9f4798f63e32633f6d2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit bbd3fd0f48b0f20174ad7fb75ff1ba75c4bd2731
Author: Jelte Jansen <jelte at isc.org>
Date: Tue Feb 14 18:28:45 2012 +0100
[1649] one more check, and doc update
-----------------------------------------------------------------------
Summary of changes:
src/lib/python/isc/config/config_data.py | 14 +++++++-------
.../python/isc/config/tests/config_data_test.py | 15 +++++++++++++--
2 files changed, 20 insertions(+), 9 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/config/config_data.py b/src/lib/python/isc/config/config_data.py
index 0fc30e9..62a4556 100644
--- a/src/lib/python/isc/config/config_data.py
+++ b/src/lib/python/isc/config/config_data.py
@@ -178,10 +178,10 @@ def find_spec_part(element, identifier, strict_identifier = True):
Parameters:
element: The specification element to start the search in
identifier: The element to find (relative to element above)
- strict_identifier: If True (the default), additional checking occurs,
- currently whether or not an index is specified
- for list elements in the identifier that are not
- the leaf node
+ strict_identifier: If True (the default), additional checking occurs.
+ Currently the only check is whether a list index is
+ specified (except for the last part of the
+ identifier)
Raises a DataNotFoundError if the data is not found, or if
strict_identifier is True and any non-final identifier parts
(i.e. before the last /) identify a list element and do not contain
@@ -645,7 +645,7 @@ class MultiConfigData:
Throws DataNotFoundError if the identifier is bad
"""
result = []
- if not identifier:
+ if not identifier or identifier == "/":
# No identifier, so we need the list of current modules
for module in self._specifications.keys():
if all:
@@ -658,9 +658,9 @@ class MultiConfigData:
result.append(entry)
else:
# Strip off start and end slashes, if they are there
- if identifier[0] == '/':
+ if len(identifier) > 0 and identifier[0] == '/':
identifier = identifier[1:]
- if identifier[-1] == '/':
+ if len(identifier) > 0 and identifier[-1] == '/':
identifier = identifier[:-1]
module, sep, id = identifier.partition('/')
spec = self.get_module_spec(module)
diff --git a/src/lib/python/isc/config/tests/config_data_test.py b/src/lib/python/isc/config/tests/config_data_test.py
index 6de8f2d..3638f05 100644
--- a/src/lib/python/isc/config/tests/config_data_test.py
+++ b/src/lib/python/isc/config/tests/config_data_test.py
@@ -520,15 +520,25 @@ class TestMultiConfigData(unittest.TestCase):
self.assertEqual(MultiConfigData.DEFAULT, status)
-
def test_get_value_maps(self):
maps = self.mcd.get_value_maps()
self.assertEqual([], maps)
module_spec = isc.config.module_spec_from_file(self.data_path + os.sep + "spec1.spec")
self.mcd.set_specification(module_spec)
+
+ expected = [{'default': False,
+ 'type': 'module',
+ 'name': 'Spec1',
+ 'value': None,
+ 'modified': False}]
+
maps = self.mcd.get_value_maps()
- self.assertEqual([{'default': False, 'type': 'module', 'name': 'Spec1', 'value': None, 'modified': False}], maps)
+ self.assertEqual(expected, maps)
+
+ maps = self.mcd.get_value_maps("/")
+ self.assertEqual(expected, maps)
+
maps = self.mcd.get_value_maps('Spec2')
self.assertEqual([], maps)
maps = self.mcd.get_value_maps('Spec1')
@@ -602,6 +612,7 @@ 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)
More information about the bind10-changes
mailing list