mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-12 17:04:40 -05:00
Update consumer.py
This commit is contained in:
parent
ba91bb154a
commit
056b314a89
@ -468,7 +468,6 @@ class ConsumerPlugin(
|
|||||||
# now that everything is done, we can start to store the document
|
# now that everything is done, we can start to store the document
|
||||||
# in the system. This will be a transaction and reasonably fast.
|
# in the system. This will be a transaction and reasonably fast.
|
||||||
success = False
|
success = False
|
||||||
result = None
|
|
||||||
store_exception = None
|
store_exception = None
|
||||||
try:
|
try:
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
@ -572,24 +571,25 @@ class ConsumerPlugin(
|
|||||||
# Return the most up to date fields
|
# Return the most up to date fields
|
||||||
document.refresh_from_db()
|
document.refresh_from_db()
|
||||||
|
|
||||||
result = f"Success. New document id {document.pk} created"
|
document_parser.cleanup()
|
||||||
elif store_exception:
|
tempdir.cleanup()
|
||||||
self._fail(
|
return f"Success. New document id {document.pk} created"
|
||||||
str(store_exception),
|
|
||||||
f"The following error occurred while storing document "
|
|
||||||
f"{self.filename} after parsing: {store_exception}",
|
|
||||||
exc_info=True,
|
|
||||||
exception=store_exception,
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
self._fail(
|
document_parser.cleanup()
|
||||||
ConsumerStatusShortMessage.FAILED,
|
tempdir.cleanup()
|
||||||
f"Error occurred while saving {self.filename}.",
|
if store_exception:
|
||||||
)
|
self._fail(
|
||||||
|
str(store_exception),
|
||||||
document_parser.cleanup()
|
f"The following error occurred while storing document "
|
||||||
tempdir.cleanup()
|
f"{self.filename} after parsing: {store_exception}",
|
||||||
return result
|
exc_info=True,
|
||||||
|
exception=store_exception,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self._fail(
|
||||||
|
ConsumerStatusShortMessage.FAILED,
|
||||||
|
f"Error occurred while saving {self.filename}.",
|
||||||
|
)
|
||||||
|
|
||||||
def _parse_title_placeholders(self, title: str) -> str:
|
def _parse_title_placeholders(self, title: str) -> str:
|
||||||
local_added = timezone.localtime(timezone.now())
|
local_added = timezone.localtime(timezone.now())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user