diff --git a/HISTORY.rst b/HISTORY.rst index ee96bd7ab2..7c4d82514d 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -9,6 +9,7 @@ * Switch to full app paths. * Split document app models into separate modules. * Split workflow views into separate modules. +* Add custom DatabaseWarning to tag the SQLite usage warning. 3.1.11 (2019-04-XX) =================== diff --git a/mayan/apps/common/apps.py b/mayan/apps/common/apps.py index fff79777b2..4c9b8027df 100644 --- a/mayan/apps/common/apps.py +++ b/mayan/apps/common/apps.py @@ -42,6 +42,7 @@ from .settings import ( from .signals import pre_initial_setup, pre_upgrade from .tasks import task_delete_stale_uploads # NOQA - Force task registration from .utils import check_for_sqlite +from .warnings import DatabaseWarning logger = logging.getLogger(__name__) @@ -89,7 +90,9 @@ class CommonApp(MayanAppConfig): def ready(self): super(CommonApp, self).ready() if check_for_sqlite(): - warnings.warn(force_text(MESSAGE_SQLITE_WARNING)) + warnings.warn( + category=DatabaseWarning, message=force_text(MESSAGE_SQLITE_WARNING) + ) Template( name='main_menu', template_name='appearance/main_menu.html' diff --git a/mayan/apps/common/warnings.py b/mayan/apps/common/warnings.py new file mode 100644 index 0000000000..ae39529700 --- /dev/null +++ b/mayan/apps/common/warnings.py @@ -0,0 +1,7 @@ +from __future__ import absolute_import + + +class DatabaseWarning(UserWarning): + """ + Warning when using unsupported database backends + """