Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed #18985 -- Restore DeprecationWarning output #385

Closed
wants to merge 1 commit into from

2 participants

Donald Stufft Ramiro Morales
Donald Stufft
Collaborator

This fixes the issue mentioned in #18985.

It will cause projects created with startproject to include a warnings.simplefilter to restore DeprecationWarning and documents the fact that this is required on Python 2.7+.

Donald Stufft dstufft Fixed #18985 -- Restore DeprecationWarning output
This fixes an issue with Python 2.7+ where Python now silences by
default the output generated by DeprecationWarning. Django relies
on this outpt to signal to developers that they are using a feature
that is going to go away soon. This change documents this fact
and mentions how to restore them in the Release Process docs. It
also includes a small change to the default manage.py used by
startproject to restore DeprecationWarning to new projects.
0e4e0d0
Ramiro Morales
Collaborator

Fixed in 44046e8. Thanks.

Ramiro Morales ramiro closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 18, 2012
  1. Donald Stufft

    Fixed #18985 -- Restore DeprecationWarning output

    dstufft authored
    This fixes an issue with Python 2.7+ where Python now silences by
    default the output generated by DeprecationWarning. Django relies
    on this outpt to signal to developers that they are using a feature
    that is going to go away soon. This change documents this fact
    and mentions how to restore them in the Release Process docs. It
    also includes a small change to the default manage.py used by
    startproject to restore DeprecationWarning to new projects.
This page is out of date. Refresh to see the latest.
6 django/conf/project_template/manage.py
View
@@ -1,8 +1,14 @@
#!/usr/bin/env python
import os
import sys
+import warnings
+
if __name__ == "__main__":
+ # Python 2.7+ (and 3.2+) have silenced DeprecationWarning by default
+ # Restore the old behavior when running Django via manage.py
+ warnings.simplefilter("default", DeprecationWarning)
+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
from django.core.management import execute_from_command_line
7 docs/internals/release-process.txt
View
@@ -68,8 +68,11 @@ So, for example, if we decided to remove a function that existed in Django 1.0:
by default; you need to explicitly turn on display of these warnings.
* Django 1.2 will contain the backwards-compatible replica, but the warning
- will be promoted to a full-fledged ``DeprecationWarning``. This warning is
- *loud* by default, and will likely be quite annoying.
+ will be promoted to a full-fledged ``DeprecationWarning``. In Python 2.6 this
+ warning is *loud* by default, and will likely be quite annoying. In order to
+ restore this loudness in Python 2.7+ simply add ``warnings.simplefilter("default", DeprecationWarning)``
+ to your project. Projects created with Django 1.5 will have this in their
+ manage.py by default.
* Django 1.3 will remove the feature outright.
4 docs/releases/1.5.txt
View
@@ -127,6 +127,10 @@ Django 1.5 also includes several smaller improvements worth noting:
configuration duplication. More information can be found in the
:func:`~django.contrib.auth.decorators.login_required` documentation.
+* The default manage.py created by startproject will now include
+ ``warnings.simplefilter("default", DeprecationWarning)``. This is to restore
+ the DeprecationWarning output when running your project through manage.py.
+
Backwards incompatible changes in 1.5
=====================================
4 tests/runtests.py
View
@@ -9,10 +9,14 @@
from django import contrib
from django.utils import six
+# Python 2.7+ (and 3.2+) have silenced DeprecationWarning by default, restore the old behavior
+warnings.simplefilter("default", DeprecationWarning)
+
# databrowse is deprecated, but we still want to run its tests
warnings.filterwarnings('ignore', "The Databrowse contrib app is deprecated",
DeprecationWarning, 'django.contrib.databrowse')
+
CONTRIB_DIR_NAME = 'django.contrib'
MODEL_TESTS_DIR_NAME = 'modeltests'
REGRESSION_TESTS_DIR_NAME = 'regressiontests'
Something went wrong with that request. Please try again.