Application Framework Reference

App Server Utilities API

deep_update_dict()

The deep_update_dict() function recursively updates a dictionary with another dictionary. Dictionary key values in the original dictionary are recursively merged with an overlay dictionary, if it exists.

Note: The original dictionary is modified by this function.

Synopsis

newDict = deep_update_dict( original , overlay )

Parameters

original

Object

Original dictionary.

overlay

Object

Dictionary to overlay on the original dictionary.

Return Value

Object

The original dictionary overlayed with the overlay dictionary.

Example

from splunk.appserver.mrsparkle.lib import util
... elided ...

@route('/:namespace/*endpoint_base/:element=_element/:element_name', methods=['POST','GET'])
@expose_page(must_login=True)
def fetch_element(self, namespace, endpoint_base, element, element_name,
                    form_defaults=None, element_overlay=None, entity_name=None, eai_attributes=None):

    ... elided ...

    element = copy.deepcopy(uiHelper_flatten[element_name])
    util.deep_update_dict(element, element_overlay)

    ... elided ...