def add_to_path_cache(self, path, entity):
        """
        Adds a path and entity to the path cache sqlite db.

        :param path: Absolute path to add.
        :param entity: Entity dictionary with values for keys 'id', 'name', and 'type'
        """

        # fix name/code discrepancy
        if "code" in entity:
            entity["name"] = entity["code"]

        path_cache = tank.path_cache.PathCache(self.tk)

        data = [{"entity": {"id": entity["id"],
                            "type": entity["type"],
                            "name": entity["name"]},
                 "metadata": [],
                 "path": path,
                 "primary": True}]
        path_cache.add_mappings(data, None, [])

        # On windows path cache has persisted, interfering with teardowns, so get rid of it.
        path_cache.close()
        del(path_cache)
示例#2
0
    def add_to_path_cache(self, path, entity):
        """
        Adds a path and entity to the path cache sqlite db.

        :param path: Absolute path to add.
        :param entity: Entity dictionary with values for keys 'id', 'name', and 'type'
        """

        # fix name/code discrepancy
        if "code" in entity:
            entity["name"] = entity["code"]

        path_cache = tank.path_cache.PathCache(self.tk)

        data = [ {"entity": {"id": entity["id"],
                             "type": entity["type"],
                             "name": entity["name"]},
                  "metadata": [],
                  "path": path,
                  "primary": True } ]
        path_cache.add_mappings(data, None, [])

        # On windows path cache has persisted, interfering with teardowns, so get rid of it.
        path_cache.close()
        del(path_cache)
示例#3
0
def add_item_to_cache(path_cache, entity, path, primary=True):
    data = [{
        "entity": entity,
        "path": path,
        "primary": primary,
        "metadata": {}
    }]
    # Last two parameters are only used for debug logging, they can be empty.
    path_cache.add_mappings(data, None, [])
示例#4
0
def add_item_to_cache(path_cache, entity, path, primary=True):

    data = [{
        "entity": entity,
        "path": path,
        "primary": primary,
        "metadata": {}
    }]
    path_cache.add_mappings(data, None, [])
示例#5
0
def add_item_to_cache(path_cache, entity, path, primary = True):
    
    data = [{"entity": entity, "path": path, "primary": primary, "metadata": {} }]    
    path_cache.add_mappings(data, None, [])