Ignore nonexistent git dates during local testing.
This commit is contained in:
parent
2e42d40063
commit
5b72015278
1 changed files with 12 additions and 6 deletions
|
@ -85,9 +85,12 @@ def git_file_edited_date(path) -> datetime.datetime:
|
|||
path,
|
||||
]
|
||||
date = check_output(command)
|
||||
date = dateutil.parser.parse(date)
|
||||
date = date.astimezone(datetime.timezone.utc)
|
||||
return date
|
||||
if date:
|
||||
date = dateutil.parser.parse(date)
|
||||
date = date.astimezone(datetime.timezone.utc)
|
||||
return date
|
||||
else:
|
||||
return datetime.datetime.now(datetime.timezone.utc)
|
||||
|
||||
def git_file_commit_history(path):
|
||||
'''
|
||||
|
@ -134,9 +137,12 @@ def git_file_published_date(path) -> datetime.datetime:
|
|||
path,
|
||||
]
|
||||
date = check_output(command)
|
||||
date = dateutil.parser.parse(date)
|
||||
date = date.astimezone(datetime.timezone.utc)
|
||||
return date
|
||||
if date:
|
||||
date = dateutil.parser.parse(date)
|
||||
date = date.astimezone(datetime.timezone.utc)
|
||||
return date
|
||||
else:
|
||||
return datetime.datetime.now(datetime.timezone.utc)
|
||||
|
||||
# SOUP
|
||||
################################################################################
|
||||
|
|
Loading…
Reference in a new issue