From 3a1384d7bbaaea7752e557cf2b14814fa88f706f Mon Sep 17 00:00:00 2001 From: Florian Spreckelsen <f.spreckelsen@indiscale.com> Date: Thu, 5 Dec 2024 18:39:37 +0100 Subject: [PATCH] FIX: Raise NotImplementedError at correct position --- src/caoscrawler/crawl.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/caoscrawler/crawl.py b/src/caoscrawler/crawl.py index fd0beaa2..e3dd0488 100644 --- a/src/caoscrawler/crawl.py +++ b/src/caoscrawler/crawl.py @@ -661,6 +661,12 @@ one with the entities that need to be updated and the other with entities to be "use for example the Scanner to create this data.")) crawled_data = self.crawled_data + if isinstance(path_for_authorized_run, list) and self.securityMode != SecurityMode.UPDATE: + raise NotImplementedError( + "Authorization of inserts and updates is currently implemented only " + "for single paths, not for lists of paths." + ) + to_be_inserted, to_be_updated = self._split_into_inserts_and_updates( SyncGraph(crawled_data, self.identifiableAdapter)) @@ -718,21 +724,11 @@ one with the entities that need to be updated and the other with entities to be update_cache = UpdateCache() pending_inserts = update_cache.get_inserts(self.run_id) if pending_inserts: - if isinstance(path_for_authorized_run, list): - raise NotImplementedError( - "Authorization of inserts is currently implemented only for single paths, " - "not for lists of paths." - ) Crawler.inform_about_pending_changes( pending_inserts, self.run_id, path_for_authorized_run) pending_updates = update_cache.get_updates(self.run_id) if pending_updates: - if isinstance(path_for_authorized_run, list): - raise NotImplementedError( - "Authorization of updates is currently implemented only for single paths, " - "not for lists of paths." - ) Crawler.inform_about_pending_changes( pending_updates, self.run_id, path_for_authorized_run) -- GitLab