python.shotgun_model.data_handler_nav module¶
-
class
ShotgunNavDataHandler
(root_path, seed_entity_field, entity_fields, cache_path, include_root=None)[source]¶ Bases:
python.shotgun_model.data_handler.ShotgunDataHandler
Shotgun Model low level data storage for use with the Shotgun Hierarchy Model.
This implements a data storage where a series of nav_expand queries are stringed together into a single cache file on disk.
-
generate_data_request
(data_retriever, path)[source]¶ Generate a data request for a data retriever.
Once the data has arrived, the caller is expected to call meth:update_data and pass in the received data payload for processing.
Parameters: data_retriever – ShotgunDataRetriever
instance.Returns: Request id or None if no work is needed
-
update_data
(**kwargs)[source]¶ The counterpart to
generate_data_request()
. When the data request has been carried out, this method should be called by the calling class and the data payload from Shotgun should be provided via the sg_data parameter.The shotgun nav data is compared against an existing part of the tree and a list of differences is returned, indicating which nodes were added, deleted and modified, on the following form:
[ { "data": ShotgunItemData instance, "mode": self.UPDATED|ADDED|DELETED }, { "data": ShotgunItemData instance, "mode": self.UPDATED|ADDED|DELETED }, ... ]
Parameters: sg_data – list, resulting from a Shotgun nav_expand query Returns: list of updates. see above Raises: ShotgunModelDataError
if no cache is loaded into memory
-