Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better logging if writing a tag/catetory/author page fails #3266

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 51 additions & 39 deletions pelican/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,57 +560,69 @@ def generate_tags(self, write):
tag_template = self.get_template("tag")
for tag, articles in self.tags.items():
dates = [article for article in self.dates if article in articles]
write(
tag.save_as,
tag_template,
self.context,
tag=tag,
url=tag.url,
articles=articles,
dates=dates,
template_name="tag",
blog=True,
page_name=tag.page_name,
all_articles=self.articles,
)
try:
write(
tag.save_as,
tag_template,
self.context,
tag=tag,
url=tag.url,
articles=articles,
dates=dates,
template_name="tag",
blog=True,
page_name=tag.page_name,
all_articles=self.articles,
)
except RuntimeError as e:
logger.error('Trying to write Tag page for "%s".' % (tag))
raise e
MinchinWeb marked this conversation as resolved.
Show resolved Hide resolved

def generate_categories(self, write):
"""Generate category pages."""
category_template = self.get_template("category")
for cat, articles in self.categories:
dates = [article for article in self.dates if article in articles]
write(
cat.save_as,
category_template,
self.context,
url=cat.url,
category=cat,
articles=articles,
dates=dates,
template_name="category",
blog=True,
page_name=cat.page_name,
all_articles=self.articles,
)
try:
write(
cat.save_as,
category_template,
self.context,
url=cat.url,
category=cat,
articles=articles,
dates=dates,
template_name="category",
blog=True,
page_name=cat.page_name,
all_articles=self.articles,
)
except RuntimeError as e:
logger.error('Trying to write Category page for "%s".' % (cat))
raise e

def generate_authors(self, write):
"""Generate Author pages."""
author_template = self.get_template("author")
for aut, articles in self.authors:
dates = [article for article in self.dates if article in articles]
write(
aut.save_as,
author_template,
self.context,
url=aut.url,
author=aut,
articles=articles,
dates=dates,
template_name="author",
blog=True,
page_name=aut.page_name,
all_articles=self.articles,
)
try:
write(
aut.save_as,
author_template,
self.context,
url=aut.url,
author=aut,
articles=articles,
dates=dates,
template_name="author",
blog=True,
page_name=aut.page_name,
all_articles=self.articles,
)
except RuntimeError as e:
logger.error('Trying to write Author page for "%s".' % (aut))
raise e

def generate_drafts(self, write):
"""Generate drafts pages."""
Expand Down