1234567891011121314151617181920 |
- def deep_update(base_dict, update_with):
- """
- Updates the base_dict (eg. settings/base.py settings) with the values present
- in the update_with dict
- """
-
- for key, value in update_with.items():
- if isinstance(value, dict):
- base_dict_value = base_dict.get(key)
-
- if isinstance(base_dict_value, dict):
- deep_update(base_dict_value, value)
- else:
- base_dict[key] = value
- else:
- base_dict[key] = value
-
- return base_dict
|