mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-03-13 20:51:24 +00:00
Compare commits
1 Commits
fix-drop-s
...
fix-email-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb5ea4065a |
@@ -40,6 +40,7 @@ from documents.plugins.base import AlwaysRunPluginMixin
|
|||||||
from documents.plugins.base import ConsumeTaskPlugin
|
from documents.plugins.base import ConsumeTaskPlugin
|
||||||
from documents.plugins.base import NoCleanupPluginMixin
|
from documents.plugins.base import NoCleanupPluginMixin
|
||||||
from documents.plugins.base import NoSetupPluginMixin
|
from documents.plugins.base import NoSetupPluginMixin
|
||||||
|
from documents.plugins.base import StopConsumeTaskError
|
||||||
from documents.plugins.date_parsing import get_date_parser
|
from documents.plugins.date_parsing import get_date_parser
|
||||||
from documents.plugins.helpers import ProgressManager
|
from documents.plugins.helpers import ProgressManager
|
||||||
from documents.plugins.helpers import ProgressStatusOptions
|
from documents.plugins.helpers import ProgressStatusOptions
|
||||||
@@ -960,10 +961,14 @@ class ConsumerPreflightPlugin(
|
|||||||
)
|
)
|
||||||
failure_msg += " Note: existing document is in the trash."
|
failure_msg += " Note: existing document is in the trash."
|
||||||
|
|
||||||
self._fail(
|
self._send_progress(
|
||||||
|
100,
|
||||||
|
100,
|
||||||
|
ProgressStatusOptions.FAILED,
|
||||||
status_msg,
|
status_msg,
|
||||||
failure_msg,
|
|
||||||
)
|
)
|
||||||
|
self.log.error(failure_msg)
|
||||||
|
raise StopConsumeTaskError(failure_msg)
|
||||||
|
|
||||||
def pre_check_directories(self) -> None:
|
def pre_check_directories(self) -> None:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ from documents.models import StoragePath
|
|||||||
from documents.models import Tag
|
from documents.models import Tag
|
||||||
from documents.parsers import DocumentParser
|
from documents.parsers import DocumentParser
|
||||||
from documents.parsers import ParseError
|
from documents.parsers import ParseError
|
||||||
|
from documents.plugins.base import StopConsumeTaskError
|
||||||
from documents.plugins.helpers import ProgressStatusOptions
|
from documents.plugins.helpers import ProgressStatusOptions
|
||||||
from documents.tasks import sanity_check
|
from documents.tasks import sanity_check
|
||||||
from documents.tests.utils import DirectoriesMixin
|
from documents.tests.utils import DirectoriesMixin
|
||||||
@@ -952,11 +953,11 @@ class TestConsumer(
|
|||||||
self.assertIsFile(dst)
|
self.assertIsFile(dst)
|
||||||
|
|
||||||
expected_message = (
|
expected_message = (
|
||||||
f"{dst.name}: Not consuming {dst.name}: "
|
f"Not consuming {dst.name}: "
|
||||||
f"It is a duplicate of {document.title} (#{document.pk})"
|
f"It is a duplicate of {document.title} (#{document.pk})"
|
||||||
)
|
)
|
||||||
|
|
||||||
with self.assertRaisesMessage(ConsumerError, expected_message):
|
with self.assertRaisesMessage(StopConsumeTaskError, expected_message):
|
||||||
with self.get_consumer(dst) as consumer:
|
with self.get_consumer(dst) as consumer:
|
||||||
consumer.run()
|
consumer.run()
|
||||||
|
|
||||||
@@ -978,12 +979,12 @@ class TestConsumer(
|
|||||||
self.assertIsFile(dst)
|
self.assertIsFile(dst)
|
||||||
|
|
||||||
expected_message = (
|
expected_message = (
|
||||||
f"{dst.name}: Not consuming {dst.name}: "
|
f"Not consuming {dst.name}: "
|
||||||
f"It is a duplicate of {document.title} (#{document.pk})"
|
f"It is a duplicate of {document.title} (#{document.pk})"
|
||||||
f" Note: existing document is in the trash."
|
f" Note: existing document is in the trash."
|
||||||
)
|
)
|
||||||
|
|
||||||
with self.assertRaisesMessage(ConsumerError, expected_message):
|
with self.assertRaisesMessage(StopConsumeTaskError, expected_message):
|
||||||
with self.get_consumer(dst) as consumer:
|
with self.get_consumer(dst) as consumer:
|
||||||
consumer.run()
|
consumer.run()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user