From 1233969c4278660677b6c5e55ee660c1bffe6b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com> Date: Fri, 15 Jul 2022 10:28:19 +0200 Subject: [PATCH] MAINT: make save_form a staticmethod --- src/caosadvancedtools/crawler.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/caosadvancedtools/crawler.py b/src/caosadvancedtools/crawler.py index 0159688c..56198d1a 100644 --- a/src/caosadvancedtools/crawler.py +++ b/src/caosadvancedtools/crawler.py @@ -428,8 +428,8 @@ class Crawler(object): # only done in SSS mode if "SHARED_DIR" in os.environ: - filename = self.save_form([el[3] - for el in pending_changes], path) + filename = Crawler.save_form([el[3] + for el in pending_changes], path, self.run_id) self.send_mail([el[3] for el in pending_changes], filename) for i, el in enumerate(pending_changes): @@ -465,7 +465,8 @@ ____________________\n""".format(i+1, len(pending_changes)) + str(el[3])) else: logger.info("Crawler terminated successfully!") - def save_form(self, changes, path): + @staticmethod + def save_form(changes, path, run_id): """ Saves an html website to a file that contains a form with a button to authorize the given changes. @@ -547,13 +548,13 @@ ____________________\n""".format(i+1, len(pending_changes)) + str(el[3])) </body> </html> """.format(url=db.configuration.get_config()["Connection"]["url"], - rid=self.run_id, + rid=run_id, changes=escape("\n".join(changes)), path=path) if "SHARED_DIR" in os.environ: directory = os.environ["SHARED_DIR"] - filename = str(self.run_id)+".html" + filename = str(run_id)+".html" randname = os.path.basename(os.path.abspath(directory)) filepath = os.path.abspath(os.path.join(directory, filename)) filename = os.path.join(randname, filename) -- GitLab