Browse Source

dict_merge(): merge lists, too

Helge Jung 10 years ago
parent
commit
0686f0caf2
1 changed files with 2 additions and 0 deletions
  1. 2 0
      ffstatus/__init__.py

+ 2 - 0
ffstatus/__init__.py

@@ -26,6 +26,8 @@ def dict_merge(a, b):
     for k, v in b.iteritems():
         if k in result and isinstance(result[k], dict):
                 result[k] = dict_merge(result[k], v)
+        elif k in result and isinstance(result[k], list):
+                result[k] = result[k] + [ deepcopy(x) for x in v if x not in result[k] ]
         else:
             result[k] = deepcopy(v)
     return result