Ticket #18042: 18042.2.diff

File 18042.2.diff, 19.9 KB (added by Aymeric Augustin, 13 years ago)
  • django/http/__init__.py

     
    297297
    298298    @property
    299299    def raw_post_data(self):
    300         warnings.warn('HttpRequest.raw_post_data has been deprecated. Use HttpRequest.body instead.', PendingDeprecationWarning)
     300        warnings.warn('HttpRequest.raw_post_data has been deprecated. Use HttpRequest.body instead.', DeprecationWarning)
    301301        return self.body
    302302
    303303    def _mark_post_parse_error(self):
  • django/conf/urls/defaults.py

     
    11import warnings
    22warnings.warn("django.conf.urls.defaults is deprecated; use django.conf.urls instead",
    3               PendingDeprecationWarning)
     3              DeprecationWarning)
    44
    55from django.conf.urls import (handler403, handler404, handler500,
    66        include, patterns, url)
  • django/conf/__init__.py

     
    181181            "handler: adding implicit debug-false-only filter. "
    182182            "See http://docs.djangoproject.com/en/dev/releases/1.4/"
    183183            "#request-exceptions-are-now-always-logged",
    184             PendingDeprecationWarning)
     184            DeprecationWarning)
    185185
    186186        filter_name = "require_debug_false"
    187187
  • django/core/cache/backends/memcached.py

     
    130130        import warnings
    131131        warnings.warn(
    132132            "memcached.CacheClass has been split into memcached.MemcachedCache and memcached.PyLibMCCache. Please update your cache backend setting.",
    133             PendingDeprecationWarning
     133            DeprecationWarning
    134134        )
    135135        try:
    136136            import memcache
  • django/core/management/__init__.py

     
    395395        "you likely need to update your 'manage.py'; "
    396396        "please see the Django 1.4 release notes "
    397397        "(https://docs.djangoproject.com/en/dev/releases/1.4/).",
    398         PendingDeprecationWarning)
     398        DeprecationWarning)
    399399
    400400    # Add this project to sys.path so that it's importable in the conventional
    401401    # way. For example, if this file (manage.py) lives in a directory
     
    451451        "you likely need to update your 'manage.py'; "
    452452        "please see the Django 1.4 release notes "
    453453        "(https://docs.djangoproject.com/en/dev/releases/1.4/).",
    454         PendingDeprecationWarning)
     454        DeprecationWarning)
    455455
    456456    setup_environ(settings_mod)
    457457    utility = ManagementUtility(argv)
  • django/views/decorators/csrf.py

     
    5555    """
    5656    warnings.warn("csrf_response_exempt is deprecated. It no longer performs a "
    5757                  "function, and calls to it can be removed.",
    58                   PendingDeprecationWarning)
     58                  DeprecationWarning)
    5959    return view_func
    6060
    6161def csrf_view_exempt(view_func):
     
    6363    Marks a view function as being exempt from CSRF view protection.
    6464    """
    6565    warnings.warn("csrf_view_exempt is deprecated. Use csrf_exempt instead.",
    66                   PendingDeprecationWarning)
     66                  DeprecationWarning)
    6767    return csrf_exempt(view_func)
    6868
    6969def csrf_exempt(view_func):
  • django/views/decorators/cache.py

     
    4444        warnings.warn('The cache_page decorator must be called like: '
    4545                      'cache_page(timeout, [cache=cache name], [key_prefix=key prefix]). '
    4646                      'All other ways are deprecated.',
    47                       PendingDeprecationWarning,
    48                       stacklevel=3)
     47                      DeprecationWarning,
     48                      stacklevel=2)
    4949
    5050    if len(args) > 1:
    5151        assert len(args) == 2, "cache_page accepts at most 2 arguments"
  • django/utils/itercompat.py

     
    2626
    2727def all(iterable):
    2828    warnings.warn("django.utils.itercompat.all is deprecated; use the native version instead",
    29                   PendingDeprecationWarning)
     29                  DeprecationWarning)
    3030    return __builtin__.all(iterable)
    3131
    3232def any(iterable):
    3333    warnings.warn("django.utils.itercompat.any is deprecated; use the native version instead",
    34                   PendingDeprecationWarning)
     34                  DeprecationWarning)
    3535    return __builtin__.any(iterable)
  • django/utils/copycompat.py

     
    77import warnings
    88
    99warnings.warn("django.utils.copycompat is deprecated; use the native copy module instead",
    10               PendingDeprecationWarning)
     10              DeprecationWarning)
    1111
    1212# Monkeypatch copy's deepcopy registry to handle functions correctly.
    1313if (hasattr(copy, '_deepcopy_dispatch') and types.FunctionType not in copy._deepcopy_dispatch):
  • django/utils/text.py

     
    206206
    207207def truncate_words(s, num, end_text='...'):
    208208    warnings.warn('This function has been deprecated. Use the Truncator class '
    209         'in django.utils.text instead.', category=PendingDeprecationWarning)
     209        'in django.utils.text instead.', category=DeprecationWarning)
    210210    truncate = end_text and ' %s' % end_text or ''
    211211    return Truncator(s).words(num, truncate=truncate)
    212212truncate_words = allow_lazy(truncate_words, unicode)
    213213
    214214def truncate_html_words(s, num, end_text='...'):
    215215    warnings.warn('This function has been deprecated. Use the Truncator class '
    216         'in django.utils.text instead.', category=PendingDeprecationWarning)
     216        'in django.utils.text instead.', category=DeprecationWarning)
    217217    truncate = end_text and ' %s' % end_text or ''
    218218    return Truncator(s).words(num, truncate=truncate, html=True)
    219219truncate_html_words = allow_lazy(truncate_html_words, unicode)
  • django/utils/hashcompat.py

     
    66
    77import warnings
    88warnings.warn("django.utils.hashcompat is deprecated; use hashlib instead",
    9               PendingDeprecationWarning)
     9              DeprecationWarning)
    1010
    1111import hashlib
    1212md5_constructor = hashlib.md5
  • django/contrib/gis/utils/geoip.py

     
    1010        def __init__(self, *args, **kwargs):
    1111            warnings.warn('GeoIP class has been moved to `django.contrib.gis.geoip`, and '
    1212                          'this shortcut will disappear in Django v1.6.',
    13                           PendingDeprecationWarning, stacklevel=2)
     13                          DeprecationWarning, stacklevel=2)
    1414            super(GeoIP, self).__init__(*args, **kwargs)
  • django/contrib/formtools/wizard/legacy.py

     
    3939        warnings.warn(
    4040            'Old-style form wizards have been deprecated; use the class-based '
    4141            'views in django.contrib.formtools.wizard.views instead.',
    42             PendingDeprecationWarning)
     42            DeprecationWarning)
    4343
    4444    def __repr__(self):
    4545        return "step: %d\nform_list: %s\ninitial_data: %s" % (self.step, self.form_list, self.initial)
  • django/contrib/formtools/tests/__init__.py

     
    77from django.contrib.formtools import preview, utils
    88from django.contrib.formtools.wizard import FormWizard
    99from django.test import TestCase
     10from django.test.utils import get_warnings_state, restore_warnings_state
    1011from django.test.utils import override_settings
    1112from django.utils import unittest
    1213
     
    4041
    4142    def setUp(self):
    4243        super(PreviewTests, self).setUp()
     44        self.save_warnings_state()
     45        warnings.filterwarnings('ignore', category=DeprecationWarning,
     46                                module='django.contrib.formtools.wizard.legacy')
     47
    4348        # Create a FormPreview instance to share between tests
    4449        self.preview = preview.FormPreview(TestForm)
    4550        input_template = '<input type="hidden" name="%s" value="%s" />'
    4651        self.input = input_template % (self.preview.unused_name('stage'), "%d")
    4752        self.test_data = {'field1':u'foo', 'field1_':u'asdf'}
    4853
     54    def tearDown(self):
     55        super(PreviewTests, self).tearDown()
     56        self.restore_warnings_state()
     57
    4958    def test_unused_name(self):
    5059        """
    5160        Verifies name mangling to get uniue field name.
  • django/contrib/admin/templatetags/adminmedia.py

     
    1111    """
    1212    warnings.warn(
    1313        "The admin_media_prefix template tag is deprecated. "
    14         "Use the static template tag instead.", PendingDeprecationWarning)
     14        "Use the static template tag instead.", DeprecationWarning)
    1515    return PrefixNode.handle_simple("ADMIN_MEDIA_PREFIX")
  • django/contrib/databrowse/__init__.py

     
    22from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite, site
    33
    44
    5 warnings.warn("The Databrowse contrib app is deprecated",
    6     PendingDeprecationWarning)
     5warnings.warn("The Databrowse contrib app is deprecated", DeprecationWarning)
  • django/contrib/localflavor/uk/uk_regions.py

     
    66import warnings
    77warnings.warn(
    88    'The "UK" prefix for United Kingdom has been deprecated in favour of the '
    9     'GB code. Please use the new GB-prefixed names.', PendingDeprecationWarning)
     9    'GB code. Please use the new GB-prefixed names.', DeprecationWarning)
    1010
    1111UK_NATIONS_CHOICES = GB_NATIONS_CHOICES
    1212UK_REGION_CHOICES  = GB_REGION_CHOICES
  • django/contrib/localflavor/uk/forms.py

     
    33import warnings
    44warnings.warn(
    55    'The "UK" prefix for United Kingdom has been deprecated in favour of the '
    6     'GB code. Please use the new GB-prefixed names.', PendingDeprecationWarning)
     6    'GB code. Please use the new GB-prefixed names.', DeprecationWarning)
    77
    88UKPostcodeField = forms.GBPostcodeField
    99UKCountySelect = forms.GBCountySelect
  • django/template/defaultfilters.py

     
    5353            warnings.warn("Setting the %s attribute of a template filter "
    5454                          "function is deprecated; use @register.filter(%s=%s) "
    5555                          "instead" % (attr, attr, getattr(func, attr)),
    56                           PendingDeprecationWarning)
     56                          DeprecationWarning)
    5757            setattr(_dec, attr, getattr(func, attr))
    5858
    5959    return wraps(func)(_dec)
  • django/middleware/common.py

     
    130130    if getattr(settings, 'IGNORABLE_404_STARTS', ()):
    131131        import warnings
    132132        warnings.warn('The IGNORABLE_404_STARTS setting has been deprecated '
    133                       'in favor of IGNORABLE_404_URLS.',
    134                       PendingDeprecationWarning)
     133                      'in favor of IGNORABLE_404_URLS.', DeprecationWarning)
    135134        for start in settings.IGNORABLE_404_STARTS:
    136135            if uri.startswith(start):
    137136                return True
    138137    if getattr(settings, 'IGNORABLE_404_ENDS', ()):
    139138        import warnings
    140139        warnings.warn('The IGNORABLE_404_ENDS setting has been deprecated '
    141                       'in favor of IGNORABLE_404_URLS.',
    142                       PendingDeprecationWarning)
     140                      'in favor of IGNORABLE_404_URLS.', DeprecationWarning)
    143141        for end in settings.IGNORABLE_404_ENDS:
    144142            if uri.endswith(end):
    145143                return True
  • tests/regressiontests/cache/tests.py

     
    14421442)
    14431443class CacheMiddlewareTest(TestCase):
    14441444
     1445    # The following tests will need to be modified in Django 1.6 to not use
     1446    # deprecated ways of using the cache_page decorator that will be removed in
     1447    # such version
    14451448    def setUp(self):
    14461449        self.factory = RequestFactory()
    14471450        self.default_cache = get_cache('default')
    14481451        self.other_cache = get_cache('other')
     1452        self.save_warnings_state()
     1453        warnings.filterwarnings('ignore', category=DeprecationWarning, module='django.views.decorators.cache')
    14491454
    14501455    def tearDown(self):
     1456        self.restore_warnings_state()
    14511457        self.default_cache.clear()
    14521458        self.other_cache.clear()
    14531459
  • tests/regressiontests/logging_tests/tests.py

     
    11import copy
     2import warnings
    23
    34from django.conf import compat_patch_logging_config
    45from django.core import mail
    56from django.test import TestCase, RequestFactory
    6 from django.test.utils import override_settings
     7from django.test.utils import override_settings, get_warnings_state, restore_warnings_state
    78from django.utils.log import CallbackFilter, RequireDebugFalse, getLogger
    89
    910
     
    4041
    4142        """
    4243        config = copy.deepcopy(OLD_LOGGING)
    43         compat_patch_logging_config(config)
    4444
     45        warnings_state = get_warnings_state()
     46        warnings.filterwarnings('ignore', category=DeprecationWarning, module='django.conf')
     47        try:
     48            compat_patch_logging_config(config)
     49        finally:
     50            restore_warnings_state(warnings_state)
     51
    4552        self.assertEqual(
    4653            config["handlers"]["mail_admins"]["filters"],
    4754            ['require_debug_false'])
  • tests/regressiontests/requests/tests.py

     
    420420                               'CONTENT_LENGTH': len(payload),
    421421                               'wsgi.input': ExplodingStringIO(payload)})
    422422
    423         with self.assertRaises(UnreadablePostError):
    424             request.raw_post_data
     423        warnings_state = get_warnings_state()
     424        warnings.filterwarnings('ignore', category=DeprecationWarning, module='django.http')
     425        try:
     426            with self.assertRaises(UnreadablePostError):
     427                request.raw_post_data
     428        finally:
     429            restore_warnings_state(warnings_state)
  • tests/regressiontests/decorators/tests.py

     
    7070
    7171    def setUp(self):
    7272        self.warning_state = get_warnings_state()
    73         warnings.filterwarnings('ignore', category=PendingDeprecationWarning,
     73        warnings.filterwarnings('ignore', category=DeprecationWarning,
    7474                                module='django.views.decorators.cache')
    7575
    7676    def tearDown(self):
  • tests/regressiontests/settings_tests/tests.py

     
    11import os
     2import warnings
    23
    34from django.conf import settings, global_settings
    45from django.core.exceptions import ImproperlyConfigured
     
    274275    Ensures proper settings file is used in setup_environ if
    275276    DJANGO_SETTINGS_MODULE is set in the environment.
    276277    """
     278    # Decide what to do with these tests when setup_environ() gets removed in Django 1.6
    277279    def setUp(self):
    278280        self.original_value = os.environ.get('DJANGO_SETTINGS_MODULE')
     281        self.save_warnings_state()
     282        warnings.filterwarnings('ignore', category=DeprecationWarning, module='django.core.management')
    279283
    280284    def tearDown(self):
     285        self.restore_warnings_state()
    281286        if self.original_value:
    282287            os.environ['DJANGO_SETTINGS_MODULE'] = self.original_value
    283288        elif 'DJANGO_SETTINGS_MODULE' in os.environ:
  • tests/regressiontests/utils/text.py

     
    11# -*- coding: utf-8 -*-
    2 import unittest
     2import warnings
    33
     4from django.test import SimpleTestCase
    45from django.utils import text
    56
    6 class TestUtilsText(unittest.TestCase):
     7class TestUtilsText(SimpleTestCase):
    78
     9    # In Django 1.6 truncate_words() and truncate_html_words() will be removed
     10    # so these tests will need to be adapted accordingly
     11    def setUp(self):
     12        self.save_warnings_state()
     13        warnings.filterwarnings('ignore', category=DeprecationWarning, module='django.utils.text')
     14
     15    def tearDown(self):
     16        self.restore_warnings_state()
     17
    818    def test_truncate_chars(self):
    919        truncator = text.Truncator(
    1020            u'The quick brown fox jumped over the lazy dog.'
  • tests/runtests.py

     
    1010
    1111# databrowse is deprecated, but we still want to run its tests
    1212warnings.filterwarnings('ignore', "The Databrowse contrib app is deprecated",
    13                         PendingDeprecationWarning, 'django.contrib.databrowse')
     13                        DeprecationWarning, 'django.contrib.databrowse')
    1414
    1515CONTRIB_DIR_NAME = 'django.contrib'
    1616MODEL_TESTS_DIR_NAME = 'modeltests'
Back to Top