Skip to content

Commit

Permalink
Deactivate searching file to add in templates directory.
Browse files Browse the repository at this point in the history
We don't have files to add (and so, no directory).
  • Loading branch information
mgautierfr committed Dec 11, 2023
1 parent 2268919 commit ca38693
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/warc2zim/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,12 @@ def __init__(self, args):

def init_env(self):
# autoescape=False to allow injecting html entities from translated text

# We don't have any files in templates directory.
# So `templates` directory doesn't exist and pkg_resources complains about that.
# Comment this part until we readd new file in `templates` directory
env = Environment(
loader=PackageLoader("warc2zim", "templates"),
# loader=PackageLoader("warc2zim", "templates"),
extensions=["jinja2.ext.i18n"],
autoescape=False,
)
Expand Down Expand Up @@ -256,11 +260,14 @@ def run(self):
Scraper=f"warc2zim {get_version()}",
).start()

for filename in pkg_resources.resource_listdir("warc2zim", "templates"):
if filename == HEAD_INSERT_FILE:
continue

self.creator.add_item(StaticArticle(self.env, filename, self.main_url))
# We don't have any files in templates directory.
# So `templates` directory doesn't exist and pkg_resources complains about that.
# Comment this part until we readd new file in `templates` directory
# for filename in pkg_resources.resource_listdir("warc2zim", "templates"):
# if filename == HEAD_INSERT_FILE:
# continue
#
# self.creator.add_item(StaticArticle(self.env, filename, self.main_url))

for record in self.iter_all_warc_records():
self.add_items_for_warc_record(record)
Expand Down

0 comments on commit ca38693

Please sign in to comment.