Refactor to get the document time once

This commit is contained in:
CkuT
2017-05-08 15:01:01 +02:00
parent da71eab0ae
commit 3f1392769d
2 changed files with 4 additions and 3 deletions

View File

@@ -95,11 +95,13 @@ class Command(Renderable, BaseCommand):
doc_file = record[EXPORTER_FILE_NAME]
thumb_file = record[EXPORTER_THUMBNAIL_NAME]
document = Document.objects.get(pk=record["pk"])
with open(doc_file, "rb") as unencrypted:
with open(document.source_path, "wb") as encrypted:
print("Encrypting {} and saving it to {}".format(
doc_file, document.source_path))
encrypted.write(GnuPG.encrypted(unencrypted))
with open(thumb_file, "rb") as unencrypted:
with open(document.thumbnail_path, "wb") as encrypted:
print("Encrypting {} and saving it to {}".format(