Skip to content

Commit d528007

Browse files
authored
Merge pull request #124 from oprypin/patch-2
Correctly check for truthiness of `generated_by`
2 parents 1116144 + c255498 commit d528007

File tree

1 file changed

+2
-2
lines changed
  • mkdocs_git_revision_date_localized_plugin

1 file changed

+2
-2
lines changed

mkdocs_git_revision_date_localized_plugin/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def on_page_markdown(
199199

200200
# Retrieve git commit timestamp
201201
# Except for generated pages (f.e. by mkdocs-gen-files plugin)
202-
if hasattr(page.file, "generated_by"):
202+
if getattr(page.file, "generated_by", None):
203203
last_revision_timestamp = int(time.time())
204204
else:
205205
last_revision_timestamp = self.util.get_git_commit_timestamp(
@@ -258,7 +258,7 @@ def on_page_markdown(
258258

259259
# Retrieve git commit timestamp
260260
# Except for generated pages (f.e. by mkdocs-gen-files plugin)
261-
if hasattr(page.file, "generated_by"):
261+
if getattr(page.file, "generated_by", None):
262262
first_revision_timestamp = int(time.time())
263263
else:
264264
first_revision_timestamp = self.util.get_git_commit_timestamp(

0 commit comments

Comments
 (0)