diff --git a/src/caosadvancedtools/crawler.py b/src/caosadvancedtools/crawler.py index ea7527bbd746334baa337926c6074e82c6610949..5d91d85cbbbff5b6f64ce9a9de1f29ca603d3b8a 100644 --- a/src/caosadvancedtools/crawler.py +++ b/src/caosadvancedtools/crawler.py @@ -66,10 +66,25 @@ def separated(text): return "-"*60 + "\n" + text -def apply_list_of_updates(to_be_updated, update_flags, +def apply_list_of_updates(to_be_updated, update_flags={}, update_cache=None, run_id=None): - """ - Updates the to_be_updated Container, i.e. pushes the changes to CaosDB + """Updates the `to_be_updated` Container, i.e., pushes the changes to CaosDB + after removing possible duplicates. If a chace is provided, uauthorized + updates can be cached for further authorization. + + Parameters: + ----------- + to_be_updated : db.Container + Container with the entities that will be updated. + update_flags : dict, optional + Dictionary of CaosDB server flags that will be used for the + update. Default is an empty dict. + update_cache : UpdateCache or None, optional + Cache in which the intended updates will be stored so they can be + authorized afterwards. Default is None. + run_id : String or None, optional + Id with which the pending updates are cached. Only meaningful if + `update_cache` is provided. Default is None. """ if len(to_be_updated) == 0: @@ -90,9 +105,10 @@ def apply_list_of_updates(to_be_updated, update_flags, baseurl = db.configuration.get_config()["Connection"]["url"] + def make_clickable(txt, id): + return "<a href='{}/Entity/{}'>{}</a>".format(baseurl, id, txt) + for el in to_be_updated: - def make_clickable(txt, id): - return "<a href='{}/Entity/{}'>{}</a>".format(baseurl, id, txt) info += str("\t" + make_clickable(el.name, el.id) if el.name is not None else "\t" + make_clickable(str(el.id), el.id))