Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Merge branch 'dev' into feature-ocrmypdf

jonaswinklerea9de1bcf1a4
diff --cc src/documents/models.py
index 5a4c9a187,cd4517a3d..358749fae
--- a/src/documents/models.py
+++ b/src/documents/models.py
@@@ -243,12 -228,9 +243,13 @@@ class Document(models.Model)
def file_name(self):
return slugify(str(self)) + self.file_type
+ @property
+ def archive_file_name(self):
+ return slugify(str(self)) + ".pdf"
+
@property
def file_type(self):
+ # TODO: this is not stable across python versions
return mimetypes.guess_extension(str(self.mime_type))
@property
diff --cc src/documents/tests/test_consumer.py
index b8644a41d,d1cd0adf1..61a98612d
--- a/src/documents/tests/test_consumer.py
+++ b/src/documents/tests/test_consumer.py
@@@ -408,17 -408,16 +408,16 @@@ def fake_magic_from_file(file, mime=Fal
@mock.patch("documents.consumer.magic.from_file", fake_magic_from_file)
- class TestConsumer(TestCase):
+ class TestConsumer(DirectoriesMixin, TestCase):
- def make_dummy_parser(self, path, logging_group):
- return DummyParser(path, logging_group, self.dirs.scratch_dir)
+ def make_dummy_parser(self, logging_group):
+ return DummyParser(logging_group, self.dirs.scratch_dir)
- def make_faulty_parser(self, path, logging_group):
- return FaultyParser(path, logging_group, self.dirs.scratch_dir)
+ def make_faulty_parser(self, logging_group):
+ return FaultyParser(logging_group, self.dirs.scratch_dir)
def setUp(self):
- self.dirs = setup_directories()
- self.addCleanup(remove_dirs, self.dirs)
+ super(TestConsumer, self).setUp()
patcher = mock.patch("documents.parsers.document_consumer_declaration.send")
m = patcher.start()