mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Adds documentation
This commit is contained in:
		| @@ -233,6 +233,7 @@ optional arguments: | |||||||
| -c, --compare-checksums | -c, --compare-checksums | ||||||
| -f, --use-filename-format | -f, --use-filename-format | ||||||
| -d, --delete | -d, --delete | ||||||
|  | -z  --zip | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| `target` is a folder to which the data gets written. This includes | `target` is a folder to which the data gets written. This includes | ||||||
| @@ -258,6 +259,9 @@ current export such as files from deleted documents, specify `--delete`. | |||||||
| Be careful when pointing paperless to a directory that already contains | Be careful when pointing paperless to a directory that already contains | ||||||
| other files. | other files. | ||||||
|  |  | ||||||
|  | If `-z` or `--zip` is provided, the export will be a zipfile | ||||||
|  | in the target directory, named according to the current date. | ||||||
|  |  | ||||||
| The filenames generated by this command follow the format | The filenames generated by this command follow the format | ||||||
| `[date created] [correspondent] [title].[extension]`. If you want | `[date created] [correspondent] [title].[extension]`. If you want | ||||||
| paperless to use `PAPERLESS_FILENAME_FORMAT` for exported filenames | paperless to use `PAPERLESS_FILENAME_FORMAT` for exported filenames | ||||||
|   | |||||||
| @@ -370,6 +370,15 @@ class TestExportImport(DirectoriesMixin, TestCase): | |||||||
|  |  | ||||||
|     @override_settings(PASSPHRASE="test") |     @override_settings(PASSPHRASE="test") | ||||||
|     def test_export_zipped(self): |     def test_export_zipped(self): | ||||||
|  |         """ | ||||||
|  |         GIVEN: | ||||||
|  |             - Request to export documents to zipfile | ||||||
|  |         WHEN: | ||||||
|  |             - Documents are exported | ||||||
|  |         THEN: | ||||||
|  |             - Zipfile is created | ||||||
|  |             - Zipfile contains exported files | ||||||
|  |         """ | ||||||
|         shutil.rmtree(os.path.join(self.dirs.media_dir, "documents")) |         shutil.rmtree(os.path.join(self.dirs.media_dir, "documents")) | ||||||
|         shutil.copytree( |         shutil.copytree( | ||||||
|             os.path.join(os.path.dirname(__file__), "samples", "documents"), |             os.path.join(os.path.dirname(__file__), "samples", "documents"), | ||||||
| @@ -394,6 +403,16 @@ class TestExportImport(DirectoriesMixin, TestCase): | |||||||
|  |  | ||||||
|     @override_settings(PASSPHRASE="test") |     @override_settings(PASSPHRASE="test") | ||||||
|     def test_export_zipped_format(self): |     def test_export_zipped_format(self): | ||||||
|  |         """ | ||||||
|  |         GIVEN: | ||||||
|  |             - Request to export documents to zipfile | ||||||
|  |             - Export is following filename formatting | ||||||
|  |         WHEN: | ||||||
|  |             - Documents are exported | ||||||
|  |         THEN: | ||||||
|  |             - Zipfile is created | ||||||
|  |             - Zipfile contains exported files | ||||||
|  |         """ | ||||||
|         shutil.rmtree(os.path.join(self.dirs.media_dir, "documents")) |         shutil.rmtree(os.path.join(self.dirs.media_dir, "documents")) | ||||||
|         shutil.copytree( |         shutil.copytree( | ||||||
|             os.path.join(os.path.dirname(__file__), "samples", "documents"), |             os.path.join(os.path.dirname(__file__), "samples", "documents"), | ||||||
| @@ -415,7 +434,6 @@ class TestExportImport(DirectoriesMixin, TestCase): | |||||||
|         self.assertTrue(os.path.isfile(expected_file)) |         self.assertTrue(os.path.isfile(expected_file)) | ||||||
|  |  | ||||||
|         with ZipFile(expected_file) as zip: |         with ZipFile(expected_file) as zip: | ||||||
|             print(zip.namelist()) |  | ||||||
|             # Extras are from the directories, which also appear in the listing |             # Extras are from the directories, which also appear in the listing | ||||||
|             self.assertEqual(len(zip.namelist()), 14) |             self.assertEqual(len(zip.namelist()), 14) | ||||||
|             self.assertIn("manifest.json", zip.namelist()) |             self.assertIn("manifest.json", zip.namelist()) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Trenton Holmes
					Trenton Holmes