Browse Source

check on config add/remove if the given identifier actually leads to a list

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@486 e5f2f494-b856-4b98-b285-d166d9295462
Jelte Jansen 15 years ago
parent
commit
7f7c99f1af
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/lib/cc/python/ISC/CC/data.py

+ 4 - 0
src/lib/cc/python/ISC/CC/data.py

@@ -330,6 +330,8 @@ class UIConfigData():
 
 
     def add(self, identifier, value_str):
     def add(self, identifier, value_str):
         data_spec = find_spec(self.config.specification, identifier)
         data_spec = find_spec(self.config.specification, identifier)
+        if (type(data_spec) != dict or "list_item_spec" not in data_spec):
+            raise DataTypeError(identifier + " is not a list")
         value = parse_value_str(value_str)
         value = parse_value_str(value_str)
         check_type(data_spec, [value])
         check_type(data_spec, [value])
         cur_list = find_no_exc(self.config_changes, identifier)
         cur_list = find_no_exc(self.config_changes, identifier)
@@ -343,6 +345,8 @@ class UIConfigData():
 
 
     def remove(self, identifier, value_str):
     def remove(self, identifier, value_str):
         data_spec = find_spec(self.config.specification, identifier)
         data_spec = find_spec(self.config.specification, identifier)
+        if (type(data_spec) != dict or "list_item_spec" not in data_spec):
+            raise DataTypeError(identifier + " is not a list")
         value = parse_value_str(value_str)
         value = parse_value_str(value_str)
         check_type(data_spec, [value])
         check_type(data_spec, [value])
         cur_list = find_no_exc(self.config_changes, identifier)
         cur_list = find_no_exc(self.config_changes, identifier)