diff options
| author | Aymeric Augustin <aymeric.augustin@polyconseil.fr> | 2012-05-03 15:27:01 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@polyconseil.fr> | 2012-05-03 15:27:01 +0200 |
| commit | e84f79f05113f546810c1908c7baef99fb1e874a (patch) | |
| tree | 4cb5f3e428caa894bd9acc06fc3cd6250b018715 /django | |
| parent | 227cec686e512412f613c3d14743b85445765d92 (diff) | |
Fixed #18042 -- Advanced deprecation warnings.
Thanks Ramiro for the patch.
Diffstat (limited to 'django')
| -rw-r--r-- | django/conf/__init__.py | 2 | ||||
| -rw-r--r-- | django/conf/urls/defaults.py | 2 | ||||
| -rw-r--r-- | django/contrib/admin/templatetags/adminmedia.py | 2 | ||||
| -rw-r--r-- | django/contrib/databrowse/__init__.py | 3 | ||||
| -rw-r--r-- | django/contrib/formtools/tests/__init__.py | 9 | ||||
| -rw-r--r-- | django/contrib/formtools/wizard/legacy.py | 2 | ||||
| -rw-r--r-- | django/contrib/gis/utils/geoip.py | 2 | ||||
| -rw-r--r-- | django/contrib/localflavor/uk/forms.py | 2 | ||||
| -rw-r--r-- | django/contrib/localflavor/uk/uk_regions.py | 2 | ||||
| -rw-r--r-- | django/core/cache/backends/memcached.py | 2 | ||||
| -rw-r--r-- | django/core/management/__init__.py | 4 | ||||
| -rw-r--r-- | django/http/__init__.py | 2 | ||||
| -rw-r--r-- | django/middleware/common.py | 6 | ||||
| -rw-r--r-- | django/template/defaultfilters.py | 2 | ||||
| -rw-r--r-- | django/utils/copycompat.py | 2 | ||||
| -rw-r--r-- | django/utils/hashcompat.py | 2 | ||||
| -rw-r--r-- | django/utils/itercompat.py | 6 | ||||
| -rw-r--r-- | django/utils/text.py | 4 | ||||
| -rw-r--r-- | django/views/decorators/cache.py | 4 | ||||
| -rw-r--r-- | django/views/decorators/csrf.py | 4 |
20 files changed, 34 insertions, 30 deletions
diff --git a/django/conf/__init__.py b/django/conf/__init__.py index 6a2485bd4b..531eed8658 100644 --- a/django/conf/__init__.py +++ b/django/conf/__init__.py @@ -181,7 +181,7 @@ def compat_patch_logging_config(logging_config): "handler: adding implicit debug-false-only filter. " "See http://docs.djangoproject.com/en/dev/releases/1.4/" "#request-exceptions-are-now-always-logged", - PendingDeprecationWarning) + DeprecationWarning) filter_name = "require_debug_false" diff --git a/django/conf/urls/defaults.py b/django/conf/urls/defaults.py index 326f05f4ba..7d5c738bad 100644 --- a/django/conf/urls/defaults.py +++ b/django/conf/urls/defaults.py @@ -1,6 +1,6 @@ import warnings warnings.warn("django.conf.urls.defaults is deprecated; use django.conf.urls instead", - PendingDeprecationWarning) + DeprecationWarning) from django.conf.urls import (handler403, handler404, handler500, include, patterns, url) diff --git a/django/contrib/admin/templatetags/adminmedia.py b/django/contrib/admin/templatetags/adminmedia.py index 753c180b02..b08d13c18f 100644 --- a/django/contrib/admin/templatetags/adminmedia.py +++ b/django/contrib/admin/templatetags/adminmedia.py @@ -11,5 +11,5 @@ def admin_media_prefix(): """ warnings.warn( "The admin_media_prefix template tag is deprecated. " - "Use the static template tag instead.", PendingDeprecationWarning) + "Use the static template tag instead.", DeprecationWarning) return PrefixNode.handle_simple("ADMIN_MEDIA_PREFIX") diff --git a/django/contrib/databrowse/__init__.py b/django/contrib/databrowse/__init__.py index 24098b013d..acb7626c8d 100644 --- a/django/contrib/databrowse/__init__.py +++ b/django/contrib/databrowse/__init__.py @@ -2,5 +2,4 @@ import warnings from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite, site -warnings.warn("The Databrowse contrib app is deprecated", - PendingDeprecationWarning) +warnings.warn("The Databrowse contrib app is deprecated", DeprecationWarning) diff --git a/django/contrib/formtools/tests/__init__.py b/django/contrib/formtools/tests/__init__.py index e628690491..96d1dda625 100644 --- a/django/contrib/formtools/tests/__init__.py +++ b/django/contrib/formtools/tests/__init__.py @@ -7,6 +7,7 @@ from django.conf import settings from django.contrib.formtools import preview, utils from django.contrib.formtools.wizard import FormWizard from django.test import TestCase +from django.test.utils import get_warnings_state, restore_warnings_state from django.test.utils import override_settings from django.utils import unittest @@ -40,12 +41,20 @@ class PreviewTests(TestCase): def setUp(self): super(PreviewTests, self).setUp() + self.save_warnings_state() + warnings.filterwarnings('ignore', category=DeprecationWarning, + module='django.contrib.formtools.wizard.legacy') + # Create a FormPreview instance to share between tests self.preview = preview.FormPreview(TestForm) input_template = '<input type="hidden" name="%s" value="%s" />' self.input = input_template % (self.preview.unused_name('stage'), "%d") self.test_data = {'field1':u'foo', 'field1_':u'asdf'} + def tearDown(self): + super(PreviewTests, self).tearDown() + self.restore_warnings_state() + def test_unused_name(self): """ Verifies name mangling to get uniue field name. diff --git a/django/contrib/formtools/wizard/legacy.py b/django/contrib/formtools/wizard/legacy.py index 532635a3d9..d07e959de0 100644 --- a/django/contrib/formtools/wizard/legacy.py +++ b/django/contrib/formtools/wizard/legacy.py @@ -39,7 +39,7 @@ class FormWizard(object): warnings.warn( 'Old-style form wizards have been deprecated; use the class-based ' 'views in django.contrib.formtools.wizard.views instead.', - PendingDeprecationWarning) + DeprecationWarning) def __repr__(self): return "step: %d\nform_list: %s\ninitial_data: %s" % (self.step, self.form_list, self.initial) diff --git a/django/contrib/gis/utils/geoip.py b/django/contrib/gis/utils/geoip.py index 2d3b2ae4e6..781917e4c9 100644 --- a/django/contrib/gis/utils/geoip.py +++ b/django/contrib/gis/utils/geoip.py @@ -10,5 +10,5 @@ if HAS_GEOIP: def __init__(self, *args, **kwargs): warnings.warn('GeoIP class has been moved to `django.contrib.gis.geoip`, and ' 'this shortcut will disappear in Django v1.6.', - PendingDeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=2) super(GeoIP, self).__init__(*args, **kwargs) diff --git a/django/contrib/localflavor/uk/forms.py b/django/contrib/localflavor/uk/forms.py index 60e63fb490..14624bc15f 100644 --- a/django/contrib/localflavor/uk/forms.py +++ b/django/contrib/localflavor/uk/forms.py @@ -3,7 +3,7 @@ from django.contrib.localflavor.gb import forms import warnings warnings.warn( 'The "UK" prefix for United Kingdom has been deprecated in favour of the ' - 'GB code. Please use the new GB-prefixed names.', PendingDeprecationWarning) + 'GB code. Please use the new GB-prefixed names.', DeprecationWarning) UKPostcodeField = forms.GBPostcodeField UKCountySelect = forms.GBCountySelect diff --git a/django/contrib/localflavor/uk/uk_regions.py b/django/contrib/localflavor/uk/uk_regions.py index 25d056c653..5af19967c7 100644 --- a/django/contrib/localflavor/uk/uk_regions.py +++ b/django/contrib/localflavor/uk/uk_regions.py @@ -6,7 +6,7 @@ from django.contrib.localflavor.gb.gb_regions import ( import warnings warnings.warn( 'The "UK" prefix for United Kingdom has been deprecated in favour of the ' - 'GB code. Please use the new GB-prefixed names.', PendingDeprecationWarning) + 'GB code. Please use the new GB-prefixed names.', DeprecationWarning) UK_NATIONS_CHOICES = GB_NATIONS_CHOICES UK_REGION_CHOICES = GB_REGION_CHOICES diff --git a/django/core/cache/backends/memcached.py b/django/core/cache/backends/memcached.py index aa1b4513c0..951c1eda26 100644 --- a/django/core/cache/backends/memcached.py +++ b/django/core/cache/backends/memcached.py @@ -130,7 +130,7 @@ class CacheClass(BaseMemcachedCache): import warnings warnings.warn( "memcached.CacheClass has been split into memcached.MemcachedCache and memcached.PyLibMCCache. Please update your cache backend setting.", - PendingDeprecationWarning + DeprecationWarning ) try: import memcache diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py index b4e82e454f..0464eb27bb 100644 --- a/django/core/management/__init__.py +++ b/django/core/management/__init__.py @@ -395,7 +395,7 @@ def setup_environ(settings_mod, original_settings_path=None): "you likely need to update your 'manage.py'; " "please see the Django 1.4 release notes " "(https://docs.djangoproject.com/en/dev/releases/1.4/).", - PendingDeprecationWarning) + DeprecationWarning) # Add this project to sys.path so that it's importable in the conventional # way. For example, if this file (manage.py) lives in a directory @@ -451,7 +451,7 @@ def execute_manager(settings_mod, argv=None): "you likely need to update your 'manage.py'; " "please see the Django 1.4 release notes " "(https://docs.djangoproject.com/en/dev/releases/1.4/).", - PendingDeprecationWarning) + DeprecationWarning) setup_environ(settings_mod) utility = ManagementUtility(argv) diff --git a/django/http/__init__.py b/django/http/__init__.py index 382f3c3f17..efcb3d93c5 100644 --- a/django/http/__init__.py +++ b/django/http/__init__.py @@ -297,7 +297,7 @@ class HttpRequest(object): @property def raw_post_data(self): - warnings.warn('HttpRequest.raw_post_data has been deprecated. Use HttpRequest.body instead.', PendingDeprecationWarning) + warnings.warn('HttpRequest.raw_post_data has been deprecated. Use HttpRequest.body instead.', DeprecationWarning) return self.body def _mark_post_parse_error(self): diff --git a/django/middleware/common.py b/django/middleware/common.py index d894ec832f..bb24977ce8 100644 --- a/django/middleware/common.py +++ b/django/middleware/common.py @@ -130,16 +130,14 @@ def _is_ignorable_404(uri): if getattr(settings, 'IGNORABLE_404_STARTS', ()): import warnings warnings.warn('The IGNORABLE_404_STARTS setting has been deprecated ' - 'in favor of IGNORABLE_404_URLS.', - PendingDeprecationWarning) + 'in favor of IGNORABLE_404_URLS.', DeprecationWarning) for start in settings.IGNORABLE_404_STARTS: if uri.startswith(start): return True if getattr(settings, 'IGNORABLE_404_ENDS', ()): import warnings warnings.warn('The IGNORABLE_404_ENDS setting has been deprecated ' - 'in favor of IGNORABLE_404_URLS.', - PendingDeprecationWarning) + 'in favor of IGNORABLE_404_URLS.', DeprecationWarning) for end in settings.IGNORABLE_404_ENDS: if uri.endswith(end): return True diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py index 55aa10d29d..1a3976f404 100644 --- a/django/template/defaultfilters.py +++ b/django/template/defaultfilters.py @@ -53,7 +53,7 @@ def stringfilter(func): warnings.warn("Setting the %s attribute of a template filter " "function is deprecated; use @register.filter(%s=%s) " "instead" % (attr, attr, getattr(func, attr)), - PendingDeprecationWarning) + DeprecationWarning) setattr(_dec, attr, getattr(func, attr)) return wraps(func)(_dec) diff --git a/django/utils/copycompat.py b/django/utils/copycompat.py index bd1a761f8a..6ccf6c3ae5 100644 --- a/django/utils/copycompat.py +++ b/django/utils/copycompat.py @@ -7,7 +7,7 @@ import types import warnings warnings.warn("django.utils.copycompat is deprecated; use the native copy module instead", - PendingDeprecationWarning) + DeprecationWarning) # Monkeypatch copy's deepcopy registry to handle functions correctly. if (hasattr(copy, '_deepcopy_dispatch') and types.FunctionType not in copy._deepcopy_dispatch): diff --git a/django/utils/hashcompat.py b/django/utils/hashcompat.py index b11fa0a686..62b1dfd12b 100644 --- a/django/utils/hashcompat.py +++ b/django/utils/hashcompat.py @@ -6,7 +6,7 @@ interface to the md5 and sha constructors, depending on system version. import warnings warnings.warn("django.utils.hashcompat is deprecated; use hashlib instead", - PendingDeprecationWarning) + DeprecationWarning) import hashlib md5_constructor = hashlib.md5 diff --git a/django/utils/itercompat.py b/django/utils/itercompat.py index dd47b7df24..2f016b1c3f 100644 --- a/django/utils/itercompat.py +++ b/django/utils/itercompat.py @@ -18,18 +18,16 @@ def is_iterable(x): return True def product(*args, **kwds): - # PendingDeprecationWarning in 1.5, remove this comment when the Deprecations - # will have been advanced for 1.5 warnings.warn("django.utils.itercompat.product is deprecated; use the native version instead", PendingDeprecationWarning) return itertools.product(*args, **kwds) def all(iterable): warnings.warn("django.utils.itercompat.all is deprecated; use the native version instead", - PendingDeprecationWarning) + DeprecationWarning) return __builtin__.all(iterable) def any(iterable): warnings.warn("django.utils.itercompat.any is deprecated; use the native version instead", - PendingDeprecationWarning) + DeprecationWarning) return __builtin__.any(iterable) diff --git a/django/utils/text.py b/django/utils/text.py index 606b15c0ce..f443b31a67 100644 --- a/django/utils/text.py +++ b/django/utils/text.py @@ -206,14 +206,14 @@ class Truncator(SimpleLazyObject): def truncate_words(s, num, end_text='...'): warnings.warn('This function has been deprecated. Use the Truncator class ' - 'in django.utils.text instead.', category=PendingDeprecationWarning) + 'in django.utils.text instead.', category=DeprecationWarning) truncate = end_text and ' %s' % end_text or '' return Truncator(s).words(num, truncate=truncate) truncate_words = allow_lazy(truncate_words, unicode) def truncate_html_words(s, num, end_text='...'): warnings.warn('This function has been deprecated. Use the Truncator class ' - 'in django.utils.text instead.', category=PendingDeprecationWarning) + 'in django.utils.text instead.', category=DeprecationWarning) truncate = end_text and ' %s' % end_text or '' return Truncator(s).words(num, truncate=truncate, html=True) truncate_html_words = allow_lazy(truncate_html_words, unicode) diff --git a/django/views/decorators/cache.py b/django/views/decorators/cache.py index ea7a3b5ebf..ac8b3752d7 100644 --- a/django/views/decorators/cache.py +++ b/django/views/decorators/cache.py @@ -44,8 +44,8 @@ def cache_page(*args, **kwargs): warnings.warn('The cache_page decorator must be called like: ' 'cache_page(timeout, [cache=cache name], [key_prefix=key prefix]). ' 'All other ways are deprecated.', - PendingDeprecationWarning, - stacklevel=3) + DeprecationWarning, + stacklevel=2) if len(args) > 1: assert len(args) == 2, "cache_page accepts at most 2 arguments" diff --git a/django/views/decorators/csrf.py b/django/views/decorators/csrf.py index 9b92d26e95..60664ff932 100644 --- a/django/views/decorators/csrf.py +++ b/django/views/decorators/csrf.py @@ -55,7 +55,7 @@ def csrf_response_exempt(view_func): """ warnings.warn("csrf_response_exempt is deprecated. It no longer performs a " "function, and calls to it can be removed.", - PendingDeprecationWarning) + DeprecationWarning) return view_func def csrf_view_exempt(view_func): @@ -63,7 +63,7 @@ def csrf_view_exempt(view_func): Marks a view function as being exempt from CSRF view protection. """ warnings.warn("csrf_view_exempt is deprecated. Use csrf_exempt instead.", - PendingDeprecationWarning) + DeprecationWarning) return csrf_exempt(view_func) def csrf_exempt(view_func): |
