Skip to content

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

add some more checks.

Jonas Winkler042103112811
diff --git a/src/documents/checks.py b/src/documents/checks.py
index 3310b1806..3e3ddb1fb 100644
--- a/src/documents/checks.py
+++ b/src/documents/checks.py
@@ -4,6 +4,8 @@ from django.conf import settings
from django.core.checks import Error, register
from django.db.utils import OperationalError, ProgrammingError
+from documents.signals import document_consumer_declaration
+
@register()
def changed_password_check(app_configs, **kwargs):
@@ -37,3 +39,17 @@ def changed_password_check(app_configs, **kwargs):
"""))]
return []
+
+
+@register()
+def parser_check(app_configs, **kwargs):
+
+ parsers = []
+ for response in document_consumer_declaration.send(None):
+ parsers.append(response[1])
+
+ if len(parsers) == 0:
+ return [Error("No parsers found. This is a bug. The consumer won't be "
+ "able to onsume any documents without parsers.")]
+ else:
+ return []
diff --git a/src/documents/parsers.py b/src/documents/parsers.py
index adc66df57..c33c1bbd4 100644
--- a/src/documents/parsers.py
+++ b/src/documents/parsers.py
@@ -45,8 +45,6 @@ def get_parser_class(doc):
for response in document_consumer_declaration.send(None):
parsers.append(response[1])
- # TODO: add a check that checks parser availability.
-
options = []
for parser in parsers:
result = parser(doc)
diff --git a/src/paperless/checks.py b/src/paperless/checks.py
index 8605d0089..bc03cb6bc 100644
--- a/src/paperless/checks.py
+++ b/src/paperless/checks.py
@@ -67,3 +67,16 @@ def binaries_check(app_configs, **kwargs):
check_messages.append(Warning(error.format(binary), hint))
return check_messages
+
+
+@register()
+def debug_mode_check(app_configs, **kwargs):
+ if settings.DEBUG:
+ return [Warning("DEBUG mode is enabled. Disable Debug mode. "
+ "This is a serious security "
+ "issue, since it puts security overides in place which"
+ "are meant to be only used during development. This"
+ "also means that paperless will tell anyone various"
+ "debugging information when something goes wrong.")]
+ else:
+ return []