Ignore nonexistent git dates during local testing.

This commit is contained in:
voussoir 2023-06-25 21:27:34 -07:00
parent 2e42d40063
commit 5b72015278

View file

@ -85,9 +85,12 @@ def git_file_edited_date(path) -> datetime.datetime:
path, path,
] ]
date = check_output(command) date = check_output(command)
date = dateutil.parser.parse(date) if date:
date = date.astimezone(datetime.timezone.utc) date = dateutil.parser.parse(date)
return date date = date.astimezone(datetime.timezone.utc)
return date
else:
return datetime.datetime.now(datetime.timezone.utc)
def git_file_commit_history(path): def git_file_commit_history(path):
''' '''
@ -134,9 +137,12 @@ def git_file_published_date(path) -> datetime.datetime:
path, path,
] ]
date = check_output(command) date = check_output(command)
date = dateutil.parser.parse(date) if date:
date = date.astimezone(datetime.timezone.utc) date = dateutil.parser.parse(date)
return date date = date.astimezone(datetime.timezone.utc)
return date
else:
return datetime.datetime.now(datetime.timezone.utc)
# SOUP # SOUP
################################################################################ ################################################################################