Add deprecation warning to convertdb

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2019-05-06 02:29:59 -04:00
parent 00d4406b1f
commit 0e6f34d0ee
5 changed files with 23 additions and 0 deletions

View File

@@ -240,6 +240,7 @@
* Remove MultipleInstanceActionMixin.
* Backport MultipleObjectMixin improvements.
* Remove ObjectListPermissionFilterMixin.
* Add deprecation warning to convertdb
3.1.11 (2019-04-XX)
===================

View File

@@ -273,6 +273,7 @@ Other changes
* Remove MultipleInstanceActionMixin.
* Backport MultipleObjectMixin improvements.
* Remove ObjectListPermissionFilterMixin.
* Add deprecation warning to convertdb
Removals
--------

View File

@@ -6,6 +6,9 @@ DEFAULT_COMMON_HOME_VIEW = 'common:home'
DELETE_STALE_UPLOADS_INTERVAL = 60 * 10 # 10 minutes
DJANGO_SQLITE_BACKEND = 'django.db.backends.sqlite3'
MESSAGE_DEPRECATION_WARNING = _(
'This feature has been deprecated and will be removed in a future version.'
)
MESSAGE_SQLITE_WARNING = _(
'Your database backend is set to use SQLite. SQLite should only be used '
'for development and testing, not for production.'

View File

@@ -2,6 +2,7 @@ from __future__ import unicode_literals
import errno
import os
import warnings
from pathlib2 import Path
@@ -14,6 +15,9 @@ from django.utils.translation import ugettext_lazy as _
from mayan.apps.documents.models import DocumentType
from mayan.apps.storage.utils import fs_cleanup
from ...literals import MESSAGE_DEPRECATION_WARNING
from ...warnings import DeprecationWarning
CONVERTDB_FOLDER = 'convertdb'
CONVERTDB_OUTPUT_FILENAME = 'migrate.json'
@@ -21,6 +25,14 @@ CONVERTDB_OUTPUT_FILENAME = 'migrate.json'
class Command(management.BaseCommand):
help = 'Convert from a database backend to another one.'
def __init__(self, *args, **kwargs):
warnings.warn(
category=DeprecationWarning,
message=force_text(MESSAGE_DEPRECATION_WARNING)
)
super(Command, self).__init__(*args, **kwargs)
def add_arguments(self, parser):
parser.add_argument(
'args', metavar='app_label[.ModelName]', nargs='*',

View File

@@ -7,6 +7,12 @@ class DatabaseWarning(UserWarning):
"""
class DeprecationWarning(UserWarning):
"""
Warning when a feature or interface has been deprecated
"""
class InterfaceWarning(UserWarning):
"""
Warning when using obsolete internal interfaces