Add custom DatabaseWarning

This warning is used to categorize the SQLite production usage
warning.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-01-31 22:23:23 -04:00
parent 0a864c2f07
commit 125a4317f4
2 changed files with 10 additions and 1 deletions

View File

@@ -41,6 +41,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__)
@@ -88,7 +89,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='menu_main', template_name='appearance/menu_main.html'

View File

@@ -1,6 +1,12 @@
from __future__ import absolute_import
class DatabaseWarning(UserWarning):
"""
Warning when using unsupported database backends
"""
class InterfaceWarning(UserWarning):
"""
Warning when using obsolete internal interfaces