mirror of
https://github.com/bellingcat/auto-archiver.git
synced 2026-06-12 05:08:28 +03:00
Further fixes/changes to loading 'types' for config + manifest edits
This commit is contained in:
@@ -16,17 +16,17 @@ from auto_archiver.utils.misc import random_str
|
||||
|
||||
@dataclass
|
||||
class HtmlFormatter(Formatter):
|
||||
name = "html_formatter"
|
||||
|
||||
def __init__(self, config: dict) -> None:
|
||||
# without this STEP.__init__ is not called
|
||||
super().__init__(config)
|
||||
self.environment = Environment(loader=FileSystemLoader(os.path.join(pathlib.Path(__file__).parent.resolve(), "templates/")), autoescape=True)
|
||||
# JinjaHelper class static methods are added as filters
|
||||
self.environment.filters.update({
|
||||
k: v.__func__ for k, v in JinjaHelpers.__dict__.items() if isinstance(v, staticmethod)
|
||||
})
|
||||
self.template = self.environment.get_template("html_template.html")
|
||||
# TODO: fix setting up template with new config method
|
||||
# def __init__(self, config: dict) -> None:
|
||||
# # without this STEP.__init__ is not called
|
||||
# super().__init__(config)
|
||||
# self.environment = Environment(loader=FileSystemLoader(os.path.join(pathlib.Path(__file__).parent.resolve(), "templates/")), autoescape=True)
|
||||
# # JinjaHelper class static methods are added as filters
|
||||
# self.environment.filters.update({
|
||||
# k: v.__func__ for k, v in JinjaHelpers.__dict__.items() if isinstance(v, staticmethod)
|
||||
# })
|
||||
# self.template = self.environment.get_template("html_template.html")
|
||||
|
||||
def format(self, item: Metadata) -> Media:
|
||||
url = item.get_url()
|
||||
|
||||
Reference in New Issue
Block a user