paperless-ngx/src/documents/signals/handlers.py

521 lines
17 KiB
Python
Raw Normal View History

import logging
import os
import shutil
2016-03-28 19:47:11 +01:00
from django.conf import settings
from django.contrib.admin.models import ADDITION
from django.contrib.admin.models import LogEntry
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.db import DatabaseError
from django.db import models
2020-12-12 01:19:22 +01:00
from django.db.models import Q
from django.dispatch import receiver
from django.utils import termcolors
from django.utils import timezone
from django_celery_results.models import TaskResult
2020-12-08 13:54:35 +01:00
from filelock import FileLock
2016-03-28 19:47:11 +01:00
2021-02-15 13:26:36 +01:00
from .. import matching
from ..file_handling import create_source_path_directory
from ..file_handling import delete_empty_directories
from ..file_handling import generate_unique_filename
from ..models import Document
from ..models import MatchingModel
from ..models import PaperlessTask
from ..models import Tag
2021-02-05 01:10:29 +01:00
logger = logging.getLogger("paperless.handlers")
def add_inbox_tags(sender, document=None, logging_group=None, **kwargs):
inbox_tags = Tag.objects.filter(is_inbox_tag=True)
document.tags.add(*inbox_tags)
2016-03-28 19:47:11 +01:00
2022-02-27 15:26:41 +01:00
def set_correspondent(
sender,
document=None,
logging_group=None,
classifier=None,
replace=False,
use_first=True,
suggest=False,
base_url=None,
color=False,
**kwargs,
):
if document.correspondent and not replace:
return
2022-02-27 15:26:41 +01:00
potential_correspondents = matching.match_correspondents(document, classifier)
potential_count = len(potential_correspondents)
if potential_correspondents:
selected = potential_correspondents[0]
else:
selected = None
if potential_count > 1:
if use_first:
2021-04-10 14:38:39 +02:00
logger.debug(
2020-11-21 14:03:45 +01:00
f"Detected {potential_count} potential correspondents, "
f"so we've opted for {selected}",
2022-02-27 15:26:41 +01:00
extra={"group": logging_group},
)
else:
2021-04-10 14:38:39 +02:00
logger.debug(
2020-11-21 14:03:45 +01:00
f"Detected {potential_count} potential correspondents, "
f"not assigning any correspondent",
2022-02-27 15:26:41 +01:00
extra={"group": logging_group},
)
return
if selected or replace:
2021-03-04 22:16:56 +01:00
if suggest:
if base_url:
print(
2022-02-27 15:26:41 +01:00
termcolors.colorize(str(document), fg="green")
2021-03-04 22:16:56 +01:00
if color
else str(document),
2021-03-04 22:16:56 +01:00
)
print(f"{base_url}/documents/{document.pk}")
else:
print(
(
2022-02-27 15:26:41 +01:00
termcolors.colorize(str(document), fg="green")
2021-03-04 22:16:56 +01:00
if color
else str(document)
2022-02-27 15:26:41 +01:00
)
+ f" [{document.pk}]",
2021-03-04 22:16:56 +01:00
)
print(f"Suggest correspondent {selected}")
else:
logger.info(
f"Assigning correspondent {selected} to {document}",
2022-02-27 15:26:41 +01:00
extra={"group": logging_group},
2021-03-04 22:16:56 +01:00
)
2021-03-04 22:16:56 +01:00
document.correspondent = selected
document.save(update_fields=("correspondent",))
2022-02-27 15:26:41 +01:00
def set_document_type(
sender,
document=None,
logging_group=None,
classifier=None,
replace=False,
use_first=True,
suggest=False,
base_url=None,
color=False,
**kwargs,
):
if document.document_type and not replace:
return
2022-02-27 15:26:41 +01:00
potential_document_type = matching.match_document_types(document, classifier)
potential_count = len(potential_document_type)
if potential_document_type:
selected = potential_document_type[0]
else:
selected = None
if potential_count > 1:
if use_first:
2021-02-05 01:10:29 +01:00
logger.info(
2020-11-21 14:03:45 +01:00
f"Detected {potential_count} potential document types, "
f"so we've opted for {selected}",
2022-02-27 15:26:41 +01:00
extra={"group": logging_group},
)
else:
2021-02-05 01:10:29 +01:00
logger.info(
2020-11-21 14:03:45 +01:00
f"Detected {potential_count} potential document types, "
f"not assigning any document type",
2022-02-27 15:26:41 +01:00
extra={"group": logging_group},
)
return
if selected or replace:
2021-03-04 22:16:56 +01:00
if suggest:
if base_url:
print(
2022-02-27 15:26:41 +01:00
termcolors.colorize(str(document), fg="green")
2021-03-04 22:16:56 +01:00
if color
else str(document),
2021-03-04 22:16:56 +01:00
)
print(f"{base_url}/documents/{document.pk}")
else:
print(
(
2022-02-27 15:26:41 +01:00
termcolors.colorize(str(document), fg="green")
2021-03-04 22:16:56 +01:00
if color
else str(document)
2022-02-27 15:26:41 +01:00
)
+ f" [{document.pk}]",
2021-03-04 22:16:56 +01:00
)
2022-02-20 15:57:26 +01:00
print(f"Suggest document type {selected}")
2021-03-04 22:16:56 +01:00
else:
logger.info(
f"Assigning document type {selected} to {document}",
2022-02-27 15:26:41 +01:00
extra={"group": logging_group},
2021-03-04 22:16:56 +01:00
)
2021-03-04 22:16:56 +01:00
document.document_type = selected
document.save(update_fields=("document_type",))
2022-02-27 15:26:41 +01:00
def set_tags(
sender,
document=None,
logging_group=None,
classifier=None,
replace=False,
suggest=False,
base_url=None,
color=False,
**kwargs,
):
2020-12-12 01:19:22 +01:00
if replace:
2020-12-12 02:06:43 +01:00
Document.tags.through.objects.filter(document=document).exclude(
Q(tag__is_inbox_tag=True),
2022-02-27 15:26:41 +01:00
).exclude(
Q(tag__match="") & ~Q(tag__matching_algorithm=Tag.MATCH_AUTO),
2020-12-12 01:19:22 +01:00
).delete()
current_tags = set(document.tags.all())
2021-01-13 17:17:23 +01:00
matched_tags = matching.match_tags(document, classifier)
2020-11-21 14:03:45 +01:00
relevant_tags = set(matched_tags) - current_tags
2021-03-04 22:16:56 +01:00
if suggest:
extra_tags = current_tags - set(matched_tags)
extra_tags = [
2022-02-27 15:26:41 +01:00
t for t in extra_tags if t.matching_algorithm == MatchingModel.MATCH_AUTO
2021-03-04 22:16:56 +01:00
]
if not relevant_tags and not extra_tags:
return
if base_url:
print(
2022-02-27 15:26:41 +01:00
termcolors.colorize(str(document), fg="green")
2021-03-04 22:16:56 +01:00
if color
else str(document),
2021-03-04 22:16:56 +01:00
)
print(f"{base_url}/documents/{document.pk}")
else:
print(
(
2022-02-27 15:26:41 +01:00
termcolors.colorize(str(document), fg="green")
2021-03-04 22:16:56 +01:00
if color
else str(document)
2022-02-27 15:26:41 +01:00
)
+ f" [{document.pk}]",
2021-03-04 22:16:56 +01:00
)
if relevant_tags:
2022-02-27 15:26:41 +01:00
print("Suggest tags: " + ", ".join([t.name for t in relevant_tags]))
2021-03-04 22:16:56 +01:00
if extra_tags:
print("Extra tags: " + ", ".join([t.name for t in extra_tags]))
else:
if not relevant_tags:
return
2021-03-04 22:16:56 +01:00
message = 'Tagging "{}" with "{}"'
logger.info(
2022-02-27 15:26:41 +01:00
message.format(document, ", ".join([t.name for t in relevant_tags])),
extra={"group": logging_group},
2021-03-04 22:16:56 +01:00
)
2021-03-04 22:16:56 +01:00
document.tags.add(*relevant_tags)
Feature: Dynamic document storage pathes (#916) * Added devcontainer * Add feature storage pathes * Exclude tests and add versioning * Check escaping * Check escaping * Check quoting * Echo * Escape * Escape : * Double escape \ * Escaping * Remove if * Escape colon * Missing \ * Esacpe : * Escape all * test * Remove sed * Fix exclude * Remove SED command * Add LD_LIBRARY_PATH * Adjusted to v1.7 * Updated test-cases * Remove devcontainer * Removed internal build-file * Run pre-commit * Corrected flak8 error * Adjusted to v1.7 * Updated test-cases * Corrected flak8 error * Adjusted to new plural translations * Small adjustments due to code-review backend * Adjusted line-break * Removed PAPERLESS prefix from settings variables * Corrected style change due to search+replace * First documentation draft * Revert changes to Pipfile * Add sphinx-autobuild with keep-outdated * Revert merge error that results in wrong storage path is evaluated * Adjust styles of generated files ... * Adds additional testing to cover dynamic storage path functionality * Remove unnecessary condition * Add hint to edit storage path dialog * Correct spelling of pathes to paths * Minor documentation tweaks * Minor typo * improving wrapping of filter editor buttons with new storage path button * Update .gitignore * Fix select border radius in non input-groups * Better storage path edit hint * Add note to edit storage path dialog re document_renamer * Add note to bulk edit storage path re document_renamer * Rename FILTER_STORAGE_DIRECTORY to PATH * Fix broken filter rule parsing * Show default storage if unspecified * Remove note re storage path on bulk edit * Add basic validation of filename variables Co-authored-by: Markus Kling <markus@markus-kling.net> Co-authored-by: Trenton Holmes <holmes.trenton@gmail.com> Co-authored-by: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Co-authored-by: Quinn Casey <quinn@quinncasey.com>
2022-05-19 23:42:25 +02:00
def set_storage_path(
sender,
document=None,
logging_group=None,
classifier=None,
replace=False,
use_first=True,
suggest=False,
base_url=None,
color=False,
**kwargs,
):
if document.storage_path and not replace:
return
potential_storage_path = matching.match_storage_paths(
document,
classifier,
)
potential_count = len(potential_storage_path)
if potential_storage_path:
selected = potential_storage_path[0]
else:
selected = None
if potential_count > 1:
if use_first:
logger.info(
f"Detected {potential_count} potential storage paths, "
f"so we've opted for {selected}",
extra={"group": logging_group},
)
else:
logger.info(
f"Detected {potential_count} potential storage paths, "
f"not assigning any storage directory",
extra={"group": logging_group},
)
return
if selected or replace:
if suggest:
if base_url:
print(
termcolors.colorize(str(document), fg="green")
if color
else str(document),
)
print(f"{base_url}/documents/{document.pk}")
else:
print(
(
termcolors.colorize(str(document), fg="green")
if color
else str(document)
)
+ f" [{document.pk}]",
)
print(f"Suggest storage directory {selected}")
Feature: Dynamic document storage pathes (#916) * Added devcontainer * Add feature storage pathes * Exclude tests and add versioning * Check escaping * Check escaping * Check quoting * Echo * Escape * Escape : * Double escape \ * Escaping * Remove if * Escape colon * Missing \ * Esacpe : * Escape all * test * Remove sed * Fix exclude * Remove SED command * Add LD_LIBRARY_PATH * Adjusted to v1.7 * Updated test-cases * Remove devcontainer * Removed internal build-file * Run pre-commit * Corrected flak8 error * Adjusted to v1.7 * Updated test-cases * Corrected flak8 error * Adjusted to new plural translations * Small adjustments due to code-review backend * Adjusted line-break * Removed PAPERLESS prefix from settings variables * Corrected style change due to search+replace * First documentation draft * Revert changes to Pipfile * Add sphinx-autobuild with keep-outdated * Revert merge error that results in wrong storage path is evaluated * Adjust styles of generated files ... * Adds additional testing to cover dynamic storage path functionality * Remove unnecessary condition * Add hint to edit storage path dialog * Correct spelling of pathes to paths * Minor documentation tweaks * Minor typo * improving wrapping of filter editor buttons with new storage path button * Update .gitignore * Fix select border radius in non input-groups * Better storage path edit hint * Add note to edit storage path dialog re document_renamer * Add note to bulk edit storage path re document_renamer * Rename FILTER_STORAGE_DIRECTORY to PATH * Fix broken filter rule parsing * Show default storage if unspecified * Remove note re storage path on bulk edit * Add basic validation of filename variables Co-authored-by: Markus Kling <markus@markus-kling.net> Co-authored-by: Trenton Holmes <holmes.trenton@gmail.com> Co-authored-by: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Co-authored-by: Quinn Casey <quinn@quinncasey.com>
2022-05-19 23:42:25 +02:00
else:
logger.info(
f"Assigning storage path {selected} to {document}",
extra={"group": logging_group},
)
document.storage_path = selected
document.save(update_fields=("storage_path",))
@receiver(models.signals.post_delete, sender=Document)
def cleanup_document_deletion(sender, instance, using, **kwargs):
with FileLock(settings.MEDIA_LOCK):
if settings.TRASH_DIR:
2022-02-20 14:04:28 +01:00
# Find a non-conflicting filename in case a document with the same
# name was moved to trash earlier
counter = 0
old_filename = os.path.split(instance.source_path)[1]
(old_filebase, old_fileext) = os.path.splitext(old_filename)
while True:
new_file_path = os.path.join(
settings.TRASH_DIR,
2022-02-27 15:26:41 +01:00
old_filebase + (f"_{counter:02}" if counter else "") + old_fileext,
)
if os.path.exists(new_file_path):
counter += 1
else:
break
2022-02-27 15:26:41 +01:00
logger.debug(f"Moving {instance.source_path} to trash at {new_file_path}")
2022-02-20 14:04:43 +01:00
try:
shutil.move(instance.source_path, new_file_path)
2022-02-20 14:04:43 +01:00
except OSError as e:
logger.error(
f"Failed to move {instance.source_path} to trash at "
f"{new_file_path}: {e}. Skipping cleanup!",
2022-02-20 14:04:43 +01:00
)
return
2022-02-27 15:26:41 +01:00
for filename in (
instance.source_path,
instance.archive_path,
instance.thumbnail_path,
):
if filename and os.path.isfile(filename):
try:
os.unlink(filename)
2022-02-27 15:26:41 +01:00
logger.debug(f"Deleted file {filename}.")
except OSError as e:
2021-02-05 01:10:29 +01:00
logger.warning(
f"While deleting document {str(instance)}, the file "
f"{filename} could not be deleted: {e}",
)
delete_empty_directories(
os.path.dirname(instance.source_path),
root=settings.ORIGINALS_DIR,
)
2020-11-30 21:38:21 +01:00
if instance.has_archive_version:
delete_empty_directories(
os.path.dirname(instance.archive_path),
root=settings.ARCHIVE_DIR,
)
2020-11-30 21:38:21 +01:00
2021-02-12 01:31:50 +01:00
class CannotMoveFilesException(Exception):
pass
2020-11-30 21:38:21 +01:00
def validate_move(instance, old_path, new_path):
if not os.path.isfile(old_path):
# Can't do anything if the old file does not exist anymore.
2022-02-27 15:26:41 +01:00
logger.fatal(f"Document {str(instance)}: File {old_path} has gone.")
2021-02-12 01:31:50 +01:00
raise CannotMoveFilesException()
2020-11-30 21:38:21 +01:00
if os.path.isfile(new_path):
# Can't do anything if the new file already exists. Skip updating file.
2021-02-05 01:10:29 +01:00
logger.warning(
2020-11-30 21:38:21 +01:00
f"Document {str(instance)}: Cannot rename file "
f"since target path {new_path} already exists.",
2022-02-27 15:26:41 +01:00
)
2021-02-12 01:31:50 +01:00
raise CannotMoveFilesException()
@receiver(models.signals.m2m_changed, sender=Document.tags.through)
@receiver(models.signals.post_save, sender=Document)
def update_filename_and_move_files(sender, instance, **kwargs):
if not instance.filename:
2020-11-30 21:38:21 +01:00
# Can't update the filename if there is no filename to begin with
# This happens when the consumer creates a new document.
# The document is modified and saved multiple times, and only after
# everything is done (i.e., the generated filename is final),
# filename will be set to the location where the consumer has put
# the file.
#
# This will in turn cause this logic to move the file where it belongs.
return
2020-12-08 13:54:35 +01:00
with FileLock(settings.MEDIA_LOCK):
2021-02-12 01:31:50 +01:00
try:
old_filename = instance.filename
old_source_path = instance.source_path
2021-02-12 01:31:50 +01:00
instance.filename = generate_unique_filename(instance)
move_original = old_filename != instance.filename
2021-02-11 13:47:17 +01:00
2021-02-12 01:31:50 +01:00
old_archive_filename = instance.archive_filename
2020-12-08 13:54:35 +01:00
old_archive_path = instance.archive_path
2021-02-12 01:31:50 +01:00
if instance.has_archive_version:
2020-11-30 21:38:21 +01:00
2021-02-12 01:31:50 +01:00
instance.archive_filename = generate_unique_filename(
instance,
archive_filename=True,
2021-02-12 01:31:50 +01:00
)
move_archive = old_archive_filename != instance.archive_filename
2021-02-12 01:31:50 +01:00
else:
move_archive = False
if not move_original and not move_archive:
# Don't do anything if filenames did not change.
return
2021-02-11 13:47:17 +01:00
if move_original:
2021-02-12 01:31:50 +01:00
validate_move(instance, old_source_path, instance.source_path)
create_source_path_directory(instance.source_path)
os.rename(old_source_path, instance.source_path)
2020-11-29 15:47:56 +01:00
2021-02-11 13:47:17 +01:00
if move_archive:
2022-02-27 15:26:41 +01:00
validate_move(instance, old_archive_path, instance.archive_path)
2021-02-12 01:31:50 +01:00
create_source_path_directory(instance.archive_path)
os.rename(old_archive_path, instance.archive_path)
2020-12-08 13:54:35 +01:00
# Don't save() here to prevent infinite recursion.
Document.objects.filter(pk=instance.pk).update(
filename=instance.filename,
archive_filename=instance.archive_filename,
)
2020-11-30 21:38:21 +01:00
2021-02-12 01:31:50 +01:00
except (OSError, DatabaseError, CannotMoveFilesException):
2021-02-11 13:47:17 +01:00
# This happens when either:
# - moving the files failed due to file system errors
# - saving to the database failed due to database errors
# In both cases, we need to revert to the original state.
# Try to move files to their original location.
2020-12-08 13:54:35 +01:00
try:
2021-02-12 01:31:50 +01:00
if move_original and os.path.isfile(instance.source_path):
os.rename(instance.source_path, old_source_path)
2021-02-11 13:47:17 +01:00
2021-02-12 01:31:50 +01:00
if move_archive and os.path.isfile(instance.archive_path):
os.rename(instance.archive_path, old_archive_path)
2021-02-11 13:47:17 +01:00
except Exception:
2020-12-08 13:54:35 +01:00
# This is fine, since:
# A: if we managed to move source from A to B, we will also
# manage to move it from B to A. If not, we have a serious
# issue that's going to get caught by the santiy checker.
# All files remain in place and will never be overwritten,
# so this is not the end of the world.
# B: if moving the orignal file failed, nothing has changed
# anyway.
pass
2021-02-12 01:31:50 +01:00
# restore old values on the instance
instance.filename = old_filename
instance.archive_filename = old_archive_filename
2020-12-08 13:54:35 +01:00
# finally, remove any empty sub folders. This will do nothing if
# something has failed above.
if not os.path.isfile(old_source_path):
2022-02-27 15:26:41 +01:00
delete_empty_directories(
os.path.dirname(old_source_path),
root=settings.ORIGINALS_DIR,
2022-02-27 15:26:41 +01:00
)
2020-12-08 13:54:35 +01:00
2022-02-27 15:26:41 +01:00
if instance.has_archive_version and not os.path.isfile(
old_archive_path,
):
2022-02-27 15:26:41 +01:00
delete_empty_directories(
os.path.dirname(old_archive_path),
root=settings.ARCHIVE_DIR,
2022-02-27 15:26:41 +01:00
)
def set_log_entry(sender, document=None, logging_group=None, **kwargs):
ct = ContentType.objects.get(model="document")
user = User.objects.get(username="consumer")
LogEntry.objects.create(
action_flag=ADDITION,
action_time=timezone.now(),
content_type=ct,
object_id=document.pk,
user=user,
object_repr=document.__str__(),
)
def add_to_index(sender, document, **kwargs):
2021-02-15 13:26:36 +01:00
from documents import index
index.add_or_update_document(document)
@receiver(models.signals.post_save, sender=TaskResult)
def update_paperless_task(sender, instance: TaskResult, **kwargs):
2022-05-23 01:52:46 -07:00
try:
if instance.task_name == "documents.tasks.consume_file":
paperless_task, _ = PaperlessTask.objects.get_or_create(
task_id=instance.task_id,
Squashed commit of the following: commit a4709b1175f730a3091907040b4d60b72e1f4cd1 Author: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu Jul 28 15:36:13 2022 -0700 Update stale.yml [skip ci] commit 3a031084f3f9542458c872daf66cea14fd7948de Author: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu Jul 28 15:24:23 2022 -0700 Update changelog.md commit 0c517e535146dc1ada8f8fa83a591e260b236ec6 Author: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu Jul 28 15:18:49 2022 -0700 v1.8.0 version strings commit 5fe435048bc6eb77f9473afc11588427846456ab Merge: 278cedf3 a722bfd0 Author: shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu Jul 28 15:17:30 2022 -0700 Merge pull request #1240 from paperless-ngx/beta [Beta] Paperless-ngx v1.8.0 Release Candidate 1 commit a722bfd09994c1adb820aa41460024fbbf8ad08c Author: Paperless-ngx Translation Bot [bot] <99855517+paperless-l10n@users.noreply.github.com> Date: Thu Jul 28 07:46:12 2022 -0700 New Crowdin updates (#1291) * New translations django.po (French) [ci skip] * New translations messages.xlf (French) [ci skip] * New translations django.po (French) [ci skip] * New translations messages.xlf (French) [ci skip] * New translations messages.xlf (Turkish) [ci skip] * New translations django.po (Turkish) [ci skip] commit f3d99a5fdbc9362721e821f85944c906d33c97df Merge: ca334770 79de0989 Author: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue Jul 26 11:21:42 2022 -0700 Merge pull request #1277 from paperless-ngx/fix/redo-ocr-button-on-edit Fix/feature: add redo ocr button to document edit view commit 79de0989d544f16394f24a99d520aef4232e5184 Author: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue Jul 26 09:54:05 2022 -0700 fix button icon spacing on mobile commit ca334770b705de3907c4396441b0d93bfd6c05da Author: Paperless-ngx Translation Bot [bot] <99855517+paperless-l10n@users.noreply.github.com> Date: Tue Jul 26 09:45:21 2022 -0700 New Crowdin updates (#1242) * New translations messages.xlf (Turkish) [ci skip] * New translations messages.xlf (German) [ci skip] * New translations django.po (German) [ci skip] * New translations messages.xlf (Italian) [ci skip] * New translations messages.xlf (Italian) [ci skip] * New translations messages.xlf (Finnish) [ci skip] * New translations messages.xlf (Finnish) [ci skip] commit 10713575059044abab24ba94cc2429d87528775e Merge: f32dfe02 ef790ca6 Author: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue Jul 26 09:44:42 2022 -0700 Merge pull request #1268 from paperless-ngx/bugfix-db-locked Bugfix: Adds configuration for database timeout, fixing database locked error commit f32dfe0278c4af1ba93d6f0c4756e30f5183daa6 Merge: 611707a3 4e78ca5d Author: shamoon <4887959+shamoon@users.noreply.github.com> Date: Mon Jul 25 12:59:31 2022 -0700 Merge pull request #1261 from paperless-ngx/fix/b1.8.0-ng-select-dropdowns Fix: dropdown selected items not visible again commit 278cedf3d01628ae7f1776f49f5cf48274a09b4c Merge: b141671d ecc4553e Author: shamoon <4887959+shamoon@users.noreply.github.com> Date: Mon Jul 25 09:25:52 2022 -0700 Merge pull request #1272 from paperless-ngx/fix-1263 Documentation: fix occasional code block color legibility commit 45a6b5a43676d8e62b09c37594e01ad98c432fba Author: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Sun Jul 24 20:15:26 2022 -0700 Add redo OCR button to document edit commit 611707a3d177836bd586b0fe667a71883cf7ff92 Merge: 2d88638d b4d20d9b Author: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sun Jul 24 19:59:30 2022 -0700 Merge pull request #1276 from paperless-ngx/bugfix-webp-import Bugfix: Document import doesn't convert thumbnails to WebP commit b4d20d9b9a4f1ff3cb90945dbbcf321e6f84c6ea Author: Trenton Holmes <holmes.trenton@gmail.com> Date: Sun Jul 24 10:22:53 2022 -0700 Fixes document import copying PNG files to .webp extensions without actual conversion commit ecc4553e673440d18f68d88c8579ef4f53f4dc80 Author: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri Jul 22 15:10:33 2022 -0700 fix occasional code block color legibility commit ef790ca6f4336095610a3fca2a4ad6507c26455e Author: Trenton Holmes <holmes.trenton@gmail.com> Date: Fri Jul 22 11:08:52 2022 -0700 Fixes the copy and paste of the log line commit 2d88638da7e144413085f29c2e9ba714648b9d69 Merge: 0e2e5f34 91ba0bd0 Author: shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri Jul 22 10:45:53 2022 -0700 Merge pull request #1269 from paperless-ngx/beta-deps-final Chore: Locks dependencies to the final versions for the beta commit 91ba0bd0af089e59157305ea23331c8b86bd8644 Author: Trenton Holmes <holmes.trenton@gmail.com> Date: Fri Jul 22 08:53:02 2022 -0700 Locks dependencies to the final versions for the beta commit 0e2e5f3413ba265ac209ec9e755702671e47f30a Author: Trenton Holmes <holmes.trenton@gmail.com> Date: Tue Jul 19 13:57:00 2022 -0700 Creates utiliy to ensure all paths in settings are normalized and absolute commit 7a99dcf69309a464648db39e59498a97715238c4 Author: Trenton Holmes <holmes.trenton@gmail.com> Date: Thu Jul 21 08:02:11 2022 -0700 Adds configuration for database timeout, documentation and troubleshotting suggestion commit 4e78ca5d82cb9b047639d92e0692436434d3a556 Author: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed Jul 20 11:15:35 2022 -0700 remove merge error ng-select css commit 83de38e56f5019fe506c52dbae1f9f5b6e81afc4 Merge: f4be2e4f b1b6d50a Author: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed Jul 20 08:26:12 2022 -0700 Merge pull request #1247 from paperless-ngx/bugfix-pikepdf-ocrmypdf-warnings Bugfix: Adds pngquant and jbig2dec to Docker image commit f4be2e4fe77f8340b1b2dffa29b0ad609bfca86a Merge: 4444925d 16b0f7f9 Author: Quinn Casey <quinn@quinncasey.com> Date: Tue Jul 19 21:03:16 2022 -0700 Merge pull request #1259 from paperless-ngx/chore-add-ci-hadolint Chore: Add Hadolint job to CI commit 16b0f7f9ee96a5fdf3c1c989dba0db9279bc907c Author: Trenton Holmes <holmes.trenton@gmail.com> Date: Tue Jul 19 14:18:47 2022 -0700 Removes a Dockerfile I can't find referenced anywhere commit 27721aef71529e133487294e79585bc2c8f6f451 Author: Trenton Holmes <holmes.trenton@gmail.com> Date: Tue Jul 19 14:01:47 2022 -0700 Fixes and updates the Hadolint action version commit 329a317fdf04ce905b9e3bfcbefb7e3a21f04659 Author: Trenton Holmes <holmes.trenton@gmail.com> Date: Tue Jul 19 13:54:33 2022 -0700 Configure Hadolint in a single location for both hooks and CI commit daad634894831b410b9348587ffdde389bf72ae2 Author: Trenton Holmes <holmes.trenton@gmail.com> Date: Fri Jul 15 13:45:23 2022 -0700 Adds a CI job for hadolint over all the Dockerfiles, fixes the minor thing it complained about commit 4444925dea6ebac6a972cb94076bc08c15ab94c2 Merge: 4c697ab5 9c1ae96d Author: shamoon <4887959+shamoon@users.noreply.github.com> Date: Mon Jul 18 15:55:29 2022 -0700 Merge pull request #1249 from paperless-ngx/fix-generated-changelog [CI] Fix automatic changelog generation on release commit 9c1ae96d336b499355cb5053516a36daa60983a0 Author: Quinn Casey <quinn@quinncasey.com> Date: Mon Jul 18 09:48:03 2022 -0700 Create PR for changelog instead of direct commit commit b1b6d50af602f2d52a2557fb921f36367e9be38c Author: Trenton Holmes <holmes.trenton@gmail.com> Date: Mon Jul 18 09:46:31 2022 -0700 Adds a couple packages to the Docker image for ocrmypdf and pikepdf commit 4c697ab50e3a4ecc92291659c9ca93921421d61d Author: Quinn Casey <quinn@quinncasey.com> Date: Sun Jul 17 15:23:28 2022 -0700 Bump version to beta commit b141671d908204dc05d1fdf3c5cad1f325f3e7a3 Merge: 48dfbbeb 2ab2d912 Author: Quinn Casey <quinn@quinncasey.com> Date: Sun Jul 17 13:18:57 2022 -0700 Merge pull request #1237 from tooomm/patch-1 chore: Run stale bot only on certain labels commit 2ab2d9127df146910130591b541258c3bb6cd4c4 Author: shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri Jul 15 20:19:28 2022 -0700 Use cant-reproduce for stale commit 278453451ec49366f993a7b9cce22a3dcaab5f1d Author: tooomm <tooomm@users.noreply.github.com> Date: Fri Jul 15 21:18:38 2022 +0200 only run on certain labels commit 48dfbbebc654464026b0137c635262073c417292 Merge: 8efb97ef e568b300 Author: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sun Jul 3 07:42:20 2022 -0700 Merge pull request #1110 from paperless-ngx/update-issue-form commit 8efb97ef4ebfad8690c32ac9e4ae0b328b1c13e1 Author: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat Jul 2 19:06:32 2022 -0700 Update stale.yml [ci skip] commit d8cda7fc1b878c43ae10733f6b807c13d50239e9 Author: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat Jul 2 17:51:39 2022 -0700 Use any-of-labels for stalebot [ci skip] commit 68f0cf419b54b2487647db84941dfb9233e54580 Merge: 666b9385 26b12512 Author: Felix E <felix@eckhofer.com> Date: Mon Jun 20 14:25:59 2022 +0200 Merge pull request #1148 from pReya/patch-1 fix: update scanner capability commit 26b12512b1fd25dba7e1180bcf1dbf70b66b8dba Author: Moritz Stückler <moritz.stueckler@gmail.com> Date: Mon Jun 20 12:06:54 2022 +0200 fix: update scanner capability The Brother ADS-A1700W does indeed support SFTP. I've just bought it, and set it up like this. commit e568b3000e9304c1aa1febfd6ab6749fc59e09a3 Author: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue Jun 7 15:28:49 2022 -0700 Add lsio to issue form commit 666b938550963d136a4f2274cafc0d8d14993761 Merge: de5eaf1c 163231d3 Author: Quinn Casey <quinn@quinncasey.com> Date: Thu May 19 17:23:23 2022 -0700 Merge pull request #990 from tooomm/patch-2 Docs: Fix headings and add links to PRs in changelog commit 163231d3076562da4079a13842b5e13cd7470611 Author: tooomm <tooomm@users.noreply.github.com> Date: Thu May 19 23:12:40 2022 +0200 Link issues, capitalization and minor fixes commit e530750fc6e405bf3a37981d9da8dbb0d33c840a Author: tooomm <tooomm@users.noreply.github.com> Date: Thu May 19 22:05:43 2022 +0200 update heading levels for v1.7.0
2022-07-28 15:36:24 -07:00
)
paperless_task.name = instance.task_name
paperless_task.created = instance.date_created
paperless_task.completed = instance.date_done
2022-06-17 23:11:29 -04:00
paperless_task.attempted_task = instance
2022-05-23 01:52:46 -07:00
paperless_task.save()
except Exception as e:
# Don't let an exception in the signal handlers prevent
# a document from being consumed.
logger.error(f"Creating PaperlessTask failed: {e}")