Actually write the date found in the file name

This commit is contained in:
Daniel Quinn
2016-08-20 18:11:51 +01:00
parent c7dda9de96
commit 1ce76a5486
3 changed files with 7 additions and 6 deletions

View File

@@ -293,6 +293,9 @@ class Consumer(object):
self.log("debug", "Saving record to database")
created = file_info.created or timezone.make_aware(
datetime.datetime.fromtimestamp(stats.st_mtime))
with open(doc, "rb") as f:
document = Document.objects.create(
correspondent=file_info.correspondent,
@@ -300,10 +303,8 @@ class Consumer(object):
content=text,
file_type=file_info.extension,
checksum=hashlib.md5(f.read()).hexdigest(),
created=timezone.make_aware(
datetime.datetime.fromtimestamp(stats.st_mtime)),
modified=timezone.make_aware(
datetime.datetime.fromtimestamp(stats.st_mtime))
created=created,
modified=created
)
relevant_tags = set(list(Tag.match_all(text)) + list(file_info.tags))