mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Chore: Bulk backend dependency updates (#8212)
This commit is contained in:
		| @@ -243,21 +243,29 @@ class TestSystemStatus(APITestCase): | ||||
|         THEN: | ||||
|             - The response contains an ERROR classifier status | ||||
|         """ | ||||
|         does_exist = tempfile.NamedTemporaryFile( | ||||
|             dir="/tmp", | ||||
|             delete=False, | ||||
|         ) | ||||
|         with override_settings(MODEL_FILE=does_exist): | ||||
|         with ( | ||||
|             tempfile.NamedTemporaryFile( | ||||
|                 dir="/tmp", | ||||
|                 delete=False, | ||||
|             ) as does_exist, | ||||
|             override_settings(MODEL_FILE=does_exist), | ||||
|         ): | ||||
|             with mock.patch("documents.classifier.load_classifier") as mock_load: | ||||
|                 mock_load.side_effect = ClassifierModelCorruptError() | ||||
|                 Document.objects.create( | ||||
|                     title="Test Document", | ||||
|                 ) | ||||
|                 Tag.objects.create(name="Test Tag", matching_algorithm=Tag.MATCH_AUTO) | ||||
|                 Tag.objects.create( | ||||
|                     name="Test Tag", | ||||
|                     matching_algorithm=Tag.MATCH_AUTO, | ||||
|                 ) | ||||
|                 self.client.force_login(self.user) | ||||
|                 response = self.client.get(self.ENDPOINT) | ||||
|                 self.assertEqual(response.status_code, status.HTTP_200_OK) | ||||
|                 self.assertEqual(response.data["tasks"]["classifier_status"], "ERROR") | ||||
|                 self.assertEqual( | ||||
|                     response.data["tasks"]["classifier_status"], | ||||
|                     "ERROR", | ||||
|                 ) | ||||
|                 self.assertIsNotNone(response.data["tasks"]["classifier_error"]) | ||||
|  | ||||
|     def test_system_status_classifier_ok_no_objects(self): | ||||
|   | ||||
| @@ -1499,7 +1499,7 @@ class BulkDownloadView(GenericAPIView): | ||||
|         follow_filename_format = serializer.validated_data.get("follow_formatting") | ||||
|  | ||||
|         settings.SCRATCH_DIR.mkdir(parents=True, exist_ok=True) | ||||
|         temp = tempfile.NamedTemporaryFile( | ||||
|         temp = tempfile.NamedTemporaryFile(  # noqa: SIM115 | ||||
|             dir=settings.SCRATCH_DIR, | ||||
|             suffix="-compressed-archive", | ||||
|             delete=False, | ||||
| @@ -1517,6 +1517,7 @@ class BulkDownloadView(GenericAPIView): | ||||
|             for document in Document.objects.filter(pk__in=ids): | ||||
|                 strategy.add_document(document) | ||||
|  | ||||
|         # TODO(stumpylog): Investigate using FileResponse here | ||||
|         with open(temp.name, "rb") as f: | ||||
|             response = HttpResponse(f, content_type="application/zip") | ||||
|             response["Content-Disposition"] = '{}; filename="{}"'.format( | ||||
|   | ||||
| @@ -365,6 +365,7 @@ class RasterisedDocumentParser(DocumentParser): | ||||
|         from ocrmypdf import EncryptedPdfError | ||||
|         from ocrmypdf import InputFileError | ||||
|         from ocrmypdf import SubprocessOutputError | ||||
|         from ocrmypdf.exceptions import DigitalSignatureError | ||||
|  | ||||
|         archive_path = Path(os.path.join(self.tempdir, "archive.pdf")) | ||||
|         sidecar_file = Path(os.path.join(self.tempdir, "sidecar.txt")) | ||||
| @@ -387,9 +388,9 @@ class RasterisedDocumentParser(DocumentParser): | ||||
|  | ||||
|             if not self.text: | ||||
|                 raise NoTextFoundException("No text was found in the original document") | ||||
|         except EncryptedPdfError: | ||||
|         except (DigitalSignatureError, EncryptedPdfError): | ||||
|             self.log.warning( | ||||
|                 "This file is encrypted, OCR is impossible. Using " | ||||
|                 "This file is encrypted and/or signed, OCR is impossible. Using " | ||||
|                 "any text present in the original file.", | ||||
|             ) | ||||
|             if original_has_text: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Trenton H
					Trenton H