Browse Source

[1843] half-related cleanup; return copies of spec parts

so that if they have nested default values, which may be set to 'local', and modified later, the original isn't changed. (technically it should be enough to do the copy when setting, but it's safer to copy them entirely for now)
Jelte Jansen 13 years ago
parent
commit
a9b59f8a77
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/lib/python/isc/config/config_data.py

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

@@ -23,6 +23,7 @@ two through the classes in ccsession)
 import isc.cc.data
 import isc.config.module_spec
 import ast
+import copy
 
 class ConfigDataError(Exception): pass
 
@@ -210,7 +211,8 @@ def find_spec_part(element, identifier, strict_identifier = True):
         cur_el = _get_map_or_list(cur_el)
 
     cur_el = _find_spec_part_single(cur_el, id_parts[-1])
-    return cur_el
+    # Due to the raw datatypes we use, it is safer to return a deep copy here
+    return copy.deepcopy(cur_el)
 
 def spec_name_list(spec, prefix="", recurse=False):
     """Returns a full list of all possible item identifiers in the