diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-06-29 18:34:41 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-06-29 18:49:37 +0200 |
| commit | acd7b34aafe352ef604edcb73f75041c5cbba6b9 (patch) | |
| tree | eecb1df66a2070e9a357380fba89febd38c488f4 /django | |
| parent | 8b9b8d3bda09eb1b447631182d06c6c5e51425f6 (diff) | |
Advanced deprecation warnings for Django 1.7.
Diffstat (limited to 'django')
26 files changed, 44 insertions, 44 deletions
diff --git a/django/conf/urls/shortcut.py b/django/conf/urls/shortcut.py index c00d176ad6..08ecd90aa3 100644 --- a/django/conf/urls/shortcut.py +++ b/django/conf/urls/shortcut.py @@ -3,7 +3,7 @@ import warnings from django.conf.urls import patterns warnings.warn("django.conf.urls.shortcut will be removed in Django 1.8.", - PendingDeprecationWarning) + DeprecationWarning) urlpatterns = patterns('django.views', (r'^(?P<content_type_id>\d+)/(?P<object_id>.*)/$', 'defaults.shortcut'), diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index fd516cb512..9c92f7ae9c 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -76,7 +76,7 @@ csrf_protect_m = method_decorator(csrf_protect) class RenameBaseModelAdminMethods(forms.MediaDefiningClass, RenameMethodsBase): renamed_methods = ( - ('queryset', 'get_queryset', PendingDeprecationWarning), + ('queryset', 'get_queryset', DeprecationWarning), ) diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index 56462dece8..f766031bf8 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -52,7 +52,7 @@ def _is_changelist_popup(request): warnings.warn( "The `%s` GET parameter has been renamed to `%s`." % (IS_LEGACY_POPUP_VAR, IS_POPUP_VAR), - PendingDeprecationWarning, 2) + DeprecationWarning, 2) return True return False @@ -60,7 +60,7 @@ def _is_changelist_popup(request): class RenameChangeListMethods(RenameMethodsBase): renamed_methods = ( - ('get_query_set', 'get_queryset', PendingDeprecationWarning), + ('get_query_set', 'get_queryset', DeprecationWarning), ) @@ -115,14 +115,14 @@ class ChangeList(six.with_metaclass(RenameChangeListMethods)): def root_query_set(self): warnings.warn("`ChangeList.root_query_set` is deprecated, " "use `root_queryset` instead.", - PendingDeprecationWarning, 2) + DeprecationWarning, 2) return self.root_queryset @property def query_set(self): warnings.warn("`ChangeList.query_set` is deprecated, " "use `queryset` instead.", - PendingDeprecationWarning, 2) + DeprecationWarning, 2) return self.queryset def get_filters_params(self, params=None): diff --git a/django/contrib/comments/__init__.py b/django/contrib/comments/__init__.py index 007b77ad7b..0b3fcebc51 100644 --- a/django/contrib/comments/__init__.py +++ b/django/contrib/comments/__init__.py @@ -6,7 +6,7 @@ from django.contrib.comments.models import Comment from django.contrib.comments.forms import CommentForm from django.utils.importlib import import_module -warnings.warn("django.contrib.comments is deprecated and will be removed before Django 1.8.", PendingDeprecationWarning) +warnings.warn("django.contrib.comments is deprecated and will be removed before Django 1.8.", DeprecationWarning) DEFAULT_COMMENTS_APP = 'django.contrib.comments' diff --git a/django/contrib/comments/templatetags/comments.py b/django/contrib/comments/templatetags/comments.py index d8eed76ad6..2b2cea5f20 100644 --- a/django/contrib/comments/templatetags/comments.py +++ b/django/contrib/comments/templatetags/comments.py @@ -12,7 +12,7 @@ register = template.Library() class RenameBaseCommentNodeMethods(RenameMethodsBase): renamed_methods = ( - ('get_query_set', 'get_queryset', PendingDeprecationWarning), + ('get_query_set', 'get_queryset', DeprecationWarning), ) diff --git a/django/contrib/contenttypes/generic.py b/django/contrib/contenttypes/generic.py index 26db4ab171..ab7c29f3e7 100644 --- a/django/contrib/contenttypes/generic.py +++ b/django/contrib/contenttypes/generic.py @@ -25,7 +25,7 @@ from django.utils.encoding import smart_text class RenameGenericForeignKeyMethods(RenameMethodsBase): renamed_methods = ( - ('get_prefetch_query_set', 'get_prefetch_queryset', PendingDeprecationWarning), + ('get_prefetch_query_set', 'get_prefetch_queryset', DeprecationWarning), ) diff --git a/django/db/__init__.py b/django/db/__init__.py index 2421ddeab8..0d7fbe2a34 100644 --- a/django/db/__init__.py +++ b/django/db/__init__.py @@ -49,7 +49,7 @@ class DefaultBackendProxy(object): @cached_property def _backend(self): warnings.warn("Accessing django.db.backend is deprecated.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) return load_backend(connections[DEFAULT_DB_ALIAS].settings_dict['ENGINE']) def __getattr__(self, item): @@ -66,7 +66,7 @@ backend = DefaultBackendProxy() def close_connection(**kwargs): warnings.warn( "close_connection is superseded by close_old_connections.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) # Avoid circular imports from django.db import transaction for conn in connections: diff --git a/django/db/backends/creation.py b/django/db/backends/creation.py index c9e5c83ade..6f66cfb7ca 100644 --- a/django/db/backends/creation.py +++ b/django/db/backends/creation.py @@ -465,7 +465,7 @@ class BaseDatabaseCreation(object): """ warnings.warn( "set_autocommit was moved from BaseDatabaseCreation to " - "BaseDatabaseWrapper.", PendingDeprecationWarning, stacklevel=2) + "BaseDatabaseWrapper.", DeprecationWarning, stacklevel=2) return self.connection.set_autocommit(True) def sql_table_creation_suffix(self): diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index 1ad4bf4706..d3bfb338fb 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -144,8 +144,8 @@ class RelatedField(Field): class RenameRelatedObjectDescriptorMethods(RenameMethodsBase): renamed_methods = ( - ('get_query_set', 'get_queryset', PendingDeprecationWarning), - ('get_prefetch_query_set', 'get_prefetch_queryset', PendingDeprecationWarning), + ('get_query_set', 'get_queryset', DeprecationWarning), + ('get_prefetch_query_set', 'get_prefetch_queryset', DeprecationWarning), ) diff --git a/django/db/models/manager.py b/django/db/models/manager.py index a1aa79f809..6817c9c8ee 100644 --- a/django/db/models/manager.py +++ b/django/db/models/manager.py @@ -50,8 +50,8 @@ signals.class_prepared.connect(ensure_default_manager) class RenameManagerMethods(RenameMethodsBase): renamed_methods = ( - ('get_query_set', 'get_queryset', PendingDeprecationWarning), - ('get_prefetch_query_set', 'get_prefetch_queryset', PendingDeprecationWarning), + ('get_query_set', 'get_queryset', DeprecationWarning), + ('get_prefetch_query_set', 'get_prefetch_queryset', DeprecationWarning), ) diff --git a/django/db/models/options.py b/django/db/models/options.py index ad25de4a3e..c6005f379d 100644 --- a/django/db/models/options.py +++ b/django/db/models/options.py @@ -130,7 +130,7 @@ class Options(object): """ warnings.warn( "Options.module_name has been deprecated in favor of model_name", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) return self.model_name def _prepare(self, model): @@ -421,7 +421,7 @@ class Options(object): warnings.warn( "`Options.get_add_permission` has been deprecated in favor " "of `django.contrib.auth.get_permission_codename`.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) return 'add_%s' % self.model_name def get_change_permission(self): @@ -432,7 +432,7 @@ class Options(object): warnings.warn( "`Options.get_change_permission` has been deprecated in favor " "of `django.contrib.auth.get_permission_codename`.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) return 'change_%s' % self.model_name def get_delete_permission(self): @@ -443,7 +443,7 @@ class Options(object): warnings.warn( "`Options.get_delete_permission` has been deprecated in favor " "of `django.contrib.auth.get_permission_codename`.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) return 'delete_%s' % self.model_name def get_all_related_objects(self, local_only=False, include_hidden=False, diff --git a/django/db/transaction.py b/django/db/transaction.py index 95b9ae165e..6031ce96c8 100644 --- a/django/db/transaction.py +++ b/django/db/transaction.py @@ -101,19 +101,19 @@ def set_clean(using=None): def is_managed(using=None): warnings.warn("'is_managed' is deprecated.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) def managed(flag=True, using=None): warnings.warn("'managed' no longer serves a purpose.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) def commit_unless_managed(using=None): warnings.warn("'commit_unless_managed' is now a no-op.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) def rollback_unless_managed(using=None): warnings.warn("'rollback_unless_managed' is now a no-op.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) ############### # Public APIs # @@ -430,7 +430,7 @@ def autocommit(using=None): your settings file and want the default behavior in some view functions. """ warnings.warn("autocommit is deprecated in favor of set_autocommit.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) def entering(using): enter_transaction_management(managed=False, using=using) @@ -448,7 +448,7 @@ def commit_on_success(using=None): control in Web apps. """ warnings.warn("commit_on_success is deprecated in favor of atomic.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) def entering(using): enter_transaction_management(using=using) @@ -478,7 +478,7 @@ def commit_manually(using=None): themselves. """ warnings.warn("commit_manually is deprecated in favor of set_autocommit.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) def entering(using): enter_transaction_management(using=using) diff --git a/django/db/utils.py b/django/db/utils.py index bd7e10d24c..acb838f940 100644 --- a/django/db/utils.py +++ b/django/db/utils.py @@ -174,7 +174,7 @@ class ConnectionHandler(object): if settings.TRANSACTIONS_MANAGED: warnings.warn( "TRANSACTIONS_MANAGED is deprecated. Use AUTOCOMMIT instead.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) conn.setdefault('AUTOCOMMIT', False) conn.setdefault('AUTOCOMMIT', True) conn.setdefault('ENGINE', 'django.db.backends.dummy') diff --git a/django/forms/forms.py b/django/forms/forms.py index b25eeb30a4..6d59271d17 100644 --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -352,7 +352,7 @@ class BaseForm(object): if hasattr(field.widget, '_has_changed'): warnings.warn("The _has_changed method on widgets is deprecated," " define it at field level instead.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) if field.widget._has_changed(initial_value, data_value): self._changed_data.append(name) elif field._has_changed(initial_value, data_value): diff --git a/django/forms/models.py b/django/forms/models.py index 821f64199b..a0c3009d38 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -260,7 +260,7 @@ class ModelFormMetaclass(type): warnings.warn("Creating a ModelForm without either the 'fields' attribute " "or the 'exclude' attribute is deprecated - form %s " "needs updating" % name, - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) if opts.fields == ALL_FIELDS: # sentinel for fields_for_model to indicate "get the list of @@ -513,7 +513,7 @@ def modelform_factory(model, form=ModelForm, fields=None, exclude=None, getattr(Meta, 'exclude', None) is None): warnings.warn("Calling modelform_factory without defining 'fields' or " "'exclude' explicitly is deprecated", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) # Instatiate type(form) in order to use the same metaclass as form. return type(form)(class_name, (form,), form_class_attrs) @@ -796,7 +796,7 @@ def modelformset_factory(model, form=ModelForm, formfield_callback=None, getattr(meta, 'exclude', exclude) is None): warnings.warn("Calling modelformset_factory without defining 'fields' or " "'exclude' explicitly is deprecated", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) form = modelform_factory(model, form=form, fields=fields, exclude=exclude, formfield_callback=formfield_callback, diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 38d1b99b0d..a92e5a56ce 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -636,7 +636,7 @@ class RadioChoiceInput(ChoiceInput): class RadioInput(RadioChoiceInput): def __init__(self, *args, **kwargs): msg = "RadioInput has been deprecated. Use RadioChoiceInput instead." - warnings.warn(msg, PendingDeprecationWarning, stacklevel=2) + warnings.warn(msg, DeprecationWarning, stacklevel=2) super(RadioInput, self).__init__(*args, **kwargs) diff --git a/django/middleware/cache.py b/django/middleware/cache.py index e13a8c3918..55b61358ea 100644 --- a/django/middleware/cache.py +++ b/django/middleware/cache.py @@ -199,7 +199,7 @@ class CacheMiddleware(UpdateCacheMiddleware, FetchFromCacheMiddleware): if self.cache_anonymous_only: msg = "CACHE_MIDDLEWARE_ANONYMOUS_ONLY has been deprecated and will be removed in Django 1.8." - warnings.warn(msg, PendingDeprecationWarning, stacklevel=1) + warnings.warn(msg, DeprecationWarning, stacklevel=1) self.cache = get_cache(self.cache_alias, **cache_kwargs) self.cache_timeout = self.cache.default_timeout diff --git a/django/middleware/common.py b/django/middleware/common.py index 2c76c47756..8f5923ac4a 100644 --- a/django/middleware/common.py +++ b/django/middleware/common.py @@ -110,7 +110,7 @@ class CommonMiddleware(object): if settings.SEND_BROKEN_LINK_EMAILS: warnings.warn("SEND_BROKEN_LINK_EMAILS is deprecated. " "Use BrokenLinkEmailsMiddleware instead.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) BrokenLinkEmailsMiddleware().process_response(request, response) if settings.USE_ETAGS: diff --git a/django/middleware/doc.py b/django/middleware/doc.py index 1af7b6150a..a2f00b6ded 100644 --- a/django/middleware/doc.py +++ b/django/middleware/doc.py @@ -1,6 +1,6 @@ """XViewMiddleware has been moved to django.contrib.admindocs.middleware.""" import warnings -warnings.warn(__doc__, PendingDeprecationWarning, stacklevel=2) +warnings.warn(__doc__, DeprecationWarning, stacklevel=2) from django.contrib.admindocs.middleware import XViewMiddleware diff --git a/django/middleware/transaction.py b/django/middleware/transaction.py index 95cc9a21f3..510176758a 100644 --- a/django/middleware/transaction.py +++ b/django/middleware/transaction.py @@ -14,7 +14,7 @@ class TransactionMiddleware(object): def __init__(self): warnings.warn( "TransactionMiddleware is deprecated in favor of ATOMIC_REQUESTS.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) if connection.settings_dict['ATOMIC_REQUESTS']: raise MiddlewareNotUsed diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index 959de3dea1..5b2a1b9501 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -568,7 +568,7 @@ def cycle(parser, token, escape=False): "'The `cycle` template tag is changing to escape its arguments; " "the non-autoescaping version is deprecated. Load it " "from the `future` tag library to start using the new behavior.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) # Note: This returns the exact same node on each {% cycle name %} call; # that is, the node object returned from {% cycle a b c as name %} and the @@ -712,7 +712,7 @@ def firstof(parser, token, escape=False): "'The `firstof` template tag is changing to escape its arguments; " "the non-autoescaping version is deprecated. Load it " "from the `future` tag library to start using the new behavior.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) bits = token.split_contents()[1:] if len(bits) < 1: diff --git a/django/test/_doctest.py b/django/test/_doctest.py index 5381cff2f0..50d772cfad 100644 --- a/django/test/_doctest.py +++ b/django/test/_doctest.py @@ -54,7 +54,7 @@ import warnings warnings.warn( "The django.test._doctest module is deprecated; " "use the doctest module from the Python standard library instead.", - PendingDeprecationWarning) + DeprecationWarning) __docformat__ = 'reStructuredText en' diff --git a/django/test/simple.py b/django/test/simple.py index f28b8a2830..874cfdff39 100644 --- a/django/test/simple.py +++ b/django/test/simple.py @@ -21,7 +21,7 @@ __all__ = ('DjangoTestSuiteRunner',) warnings.warn( "The django.test.simple module and DjangoTestSuiteRunner are deprecated; " "use django.test.runner.DiscoverRunner instead.", - PendingDeprecationWarning) + DeprecationWarning) # The module name for tests outside models.py TEST_MODULE = 'tests' diff --git a/django/utils/image.py b/django/utils/image.py index d251ab9d0b..2fd0c6e6b0 100644 --- a/django/utils/image.py +++ b/django/utils/image.py @@ -139,7 +139,7 @@ def _detect_image_library(): warnings.warn( "Support for the PIL will be removed in Django 1.8. Please " + "uninstall it & install Pillow instead.", - PendingDeprecationWarning + DeprecationWarning ) return PILImage, PIL_imaging, PILImageFile diff --git a/django/views/defaults.py b/django/views/defaults.py index c8a62fc753..e9d0f16a33 100644 --- a/django/views/defaults.py +++ b/django/views/defaults.py @@ -83,6 +83,6 @@ def shortcut(request, content_type_id, object_id): warnings.warn( "django.views.defaults.shortcut will be removed in Django 1.8. " "Import it from django.contrib.contenttypes.views instead.", - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) from django.contrib.contenttypes.views import shortcut as real_shortcut return real_shortcut(request, content_type_id, object_id) diff --git a/django/views/generic/edit.py b/django/views/generic/edit.py index fccacf0bd3..0a8301f0db 100644 --- a/django/views/generic/edit.py +++ b/django/views/generic/edit.py @@ -113,7 +113,7 @@ class ModelFormMixin(FormMixin, SingleObjectMixin): if self.fields is None: warnings.warn("Using ModelFormMixin (base class of %s) without " "the 'fields' attribute is deprecated." % self.__class__.__name__, - PendingDeprecationWarning) + DeprecationWarning) return model_forms.modelform_factory(model, fields=self.fields) |
