[svn] commit: r826 - /branches/jelte-configuration/src/lib/config/python/isc/config/datadefinition.py

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Feb 15 15:40:44 UTC 2010


Author: jelte
Date: Mon Feb 15 15:40:44 2010
New Revision: 826

Log:
empty list evaluates to False, so check for None explicitely

Modified:
    branches/jelte-configuration/src/lib/config/python/isc/config/datadefinition.py

Modified: branches/jelte-configuration/src/lib/config/python/isc/config/datadefinition.py
==============================================================================
--- branches/jelte-configuration/src/lib/config/python/isc/config/datadefinition.py (original)
+++ branches/jelte-configuration/src/lib/config/python/isc/config/datadefinition.py Mon Feb 15 15:40:44 2010
@@ -65,7 +65,6 @@
             if errors:
                 errors.append("The is no config_data for this specification")
             return False
-        errors = []
         return _validate_spec_list(data_def['config_data'], full, data, errors)
 
 
@@ -207,27 +206,27 @@
        specification"""
     data_type = spec['item_type']
     if data_type == "integer" and type(value) != int:
-        if errors:
+        if errors != None:
             errors.append(str(value) + " should be an integer")
         return False
     elif data_type == "real" and type(value) != float:
-        if errors:
+        if errors != None:
             errors.append(str(value) + " should be a real")
         return False
     elif data_type == "boolean" and type(value) != bool:
-        if errors:
+        if errors != None:
             errors.append(str(value) + " should be a boolean")
         return False
     elif data_type == "string" and type(value) != str:
-        if errors:
+        if errors != None:
             errors.append(str(value) + " should be a string")
         return False
     elif data_type == "list" and type(value) != list:
-        if errors:
+        if errors != None:
             errors.append(str(value) + " should be a list, not a " + str(value.__class__.__name__))
         return False
     elif data_type == "map" and type(value) != dict:
-        if errors:
+        if errors != None:
             errors.append(str(value) + " should be a map")
         return False
     else:
@@ -256,7 +255,7 @@
     if item_name in data:
         return _validate_item(spec, data[item_name], errors)
     elif full and not item_optional:
-        if errors:
+        if errors != None:
             errors.append("non-optional item " + item_name + " missing")
         return False
     else:




More information about the bind10-changes mailing list