Skip to content
Snippets Groups Projects
Commit 9e522b1a authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

Merge branch 'f-save-form' into tmp

parents 62d9b98f fad5dc48
Branches
Tags
2 merge requests!54REL: Release 0.5.0,!48MAINT: make send_mail in crawler static
Pipeline #25979 passed
......@@ -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)
Crawler.send_mail([el[3] for el in pending_changes], filename)
for i, el in enumerate(pending_changes):
......@@ -464,7 +464,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.
......@@ -546,13 +547,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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment