A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Refactor to get the document time once
CkuT3f1392769d52
diff --git a/src/documents/management/commands/document_exporter.py b/src/documents/management/commands/document_exporter.pyindex 2a4e03ad7..f7a06139e 100644--- a/src/documents/management/commands/document_exporter.py+++ b/src/documents/management/commands/document_exporter.py@@ -69,15 +69,14 @@ class Command(Renderable, BaseCommand):print("Exporting: {}".format(target))+ t = int(time.mktime(document.created.timetuple()))with open(target, "wb") as f:f.write(GnuPG.decrypted(document.source_file))- t = int(time.mktime(document.created.timetuple()))os.utime(target, times=(t, t))with open(thumbnail_target, "wb") as f:f.write(GnuPG.decrypted(document.thumbnail_file))- t = int(time.mktime(document.created.timetuple()))- os.utime(target, times=(t, t))+ os.utime(thumbnail_target, times=(t, t))manifest += json.loads(serializers.serialize("json", Correspondent.objects.all()))diff --git a/src/documents/management/commands/document_importer.py b/src/documents/management/commands/document_importer.pyindex 942f10c00..a2a496edf 100644--- a/src/documents/management/commands/document_importer.py+++ b/src/documents/management/commands/document_importer.py@@ -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(