BIND 10 trac3373, updated. 688e0b46933ffe567833f0e5c208117acf98c55e [3373] Addressed review comments.

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Mar 11 11:57:40 UTC 2014


The branch, trac3373 has been updated
       via  688e0b46933ffe567833f0e5c208117acf98c55e (commit)
      from  bf76c3bd4855432b96d05b67774c8d53702fe275 (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 688e0b46933ffe567833f0e5c208117acf98c55e
Author: Thomas Markwalder <tmark at isc.org>
Date:   Tue Mar 11 07:56:22 2014 -0400

    [3373] Addressed review comments.
    
    The merge logic was simplified a bit and the commentary was improved.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/python/isc/cc/data.py |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/cc/data.py b/src/lib/python/isc/cc/data.py
index 19d65d1..0e084e2 100644
--- a/src/lib/python/isc/cc/data.py
+++ b/src/lib/python/isc/cc/data.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2010  Internet Systems Consortium.
+# Copyright (C) 2010-2014  Internet Systems Consortium.
 #
 # Permission to use, copy, modify, and distribute this software for any
 # purpose with or without fee is hereby granted, provided that the above
@@ -51,20 +51,18 @@ def remove_identical(a, b):
         del(a[id])
 
 def merge(orig, new):
-    """Merges the contents of new into orig. If the element is dict
-       orig and then it goes recursive to merge the maps.
-       If an element value is None in new it will be removed in orig.
-       Previously this method was relying on dict.update but this does
-       not do deep merges in the manner required."""
+    """Merges the contents of one dictionary into another.
+       The merge is done element by element, in order to recursivley merge
+       any elements which are themselves dictionaries. If an element value
+       is None in new it will be removed in orig. Previously this method
+       relied on dict.update but this does not do deep merges properly.
+       Raises a DataTypeError is either argument is not a dict"""
     if type(orig) != dict or type(new) != dict:
         raise DataTypeError("Not a dict in merge()")
 
     for key in new.keys():
-        if (key in orig):
-            if (type(orig[key]) == dict):
-                merge(orig[key], new[key])
-            else:
-                orig[key] = new[key]
+        if ((key in orig) and (type(orig[key]) == dict)):
+            merge(orig[key], new[key])
         else:
             orig[key] = new[key]
 



More information about the bind10-changes mailing list