Skip to content

Commit

Permalink
No need for an extra import, the object is smart already
Browse files Browse the repository at this point in the history
  • Loading branch information
stumpylog committed Nov 1, 2022
1 parent 3913c68 commit f55ff83
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/documents/file_handling.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import datetime
import logging
import os
from collections import defaultdict
Expand Down Expand Up @@ -172,22 +171,22 @@ def generate_filename(doc, counter=0, append_gpg=True, archive_filename=False):
else:
asn = "-none-"

# Convert UTC database date to localized date
# Convert UTC database datetime to localized date
local_added = timezone.localdate(doc.added)
local_created = timezone.localdate(doc.created)

path = filename_format.format(
title=pathvalidate.sanitize_filename(doc.title, replacement_text="-"),
correspondent=correspondent,
document_type=document_type,
created=datetime.date.isoformat(local_created),
created=local_created.isoformat(),
created_year=local_created.strftime("%Y"),
created_year_short=local_created.strftime("%y"),
created_month=local_created.strftime("%m"),
created_month_name=local_created.strftime("%B"),
created_month_name_short=local_created.strftime("%b"),
created_day=local_created.strftime("%d"),
added=datetime.date.isoformat(local_added),
added=local_added.isoformat(),
added_year=local_added.strftime("%Y"),
added_year_short=local_added.strftime("%y"),
added_month=local_added.strftime("%m"),
Expand Down

0 comments on commit f55ff83

Please sign in to comment.