Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fixed #18985 -- Restore DeprecationWarning output #385

Closed
wants to merge 1 commit into from

2 participants

Donald Stufft Ramiro Morales
Donald Stufft
Owner

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 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
Owner

Fixed in 44046e8. Thanks.

Ramiro Morales ramiro closed this January 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Sep 18, 2012
Donald Stufft 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
This page is out of date. Refresh to see the latest.
6  django/conf/project_template/manage.py
... ...
@@ -1,8 +1,14 @@
1 1
 #!/usr/bin/env python
2 2
 import os
3 3
 import sys
  4
+import warnings
  5
+
4 6
 
5 7
 if __name__ == "__main__":
  8
+    # Python 2.7+ (and 3.2+) have silenced DeprecationWarning by default
  9
+    # Restore the old behavior when running Django via manage.py
  10
+    warnings.simplefilter("default", DeprecationWarning)
  11
+
6 12
     os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
7 13
 
8 14
     from django.core.management import execute_from_command_line
7  docs/internals/release-process.txt
@@ -68,8 +68,11 @@ So, for example, if we decided to remove a function that existed in Django 1.0:
68 68
   by default; you need to explicitly turn on display of these warnings.
69 69
 
70 70
 * Django 1.2 will contain the backwards-compatible replica, but the warning
71  
-  will be promoted to a full-fledged ``DeprecationWarning``. This warning is
72  
-  *loud* by default, and will likely be quite annoying.
  71
+  will be promoted to a full-fledged ``DeprecationWarning``. In Python 2.6 this
  72
+  warning is *loud* by default, and will likely be quite annoying. In order to
  73
+  restore this loudness in Python 2.7+ simply add ``warnings.simplefilter("default", DeprecationWarning)``
  74
+  to your project. Projects created with Django 1.5 will have this in their
  75
+  manage.py by default.
73 76
 
74 77
 * Django 1.3 will remove the feature outright.
75 78
 
4  docs/releases/1.5.txt
@@ -127,6 +127,10 @@ Django 1.5 also includes several smaller improvements worth noting:
127 127
   configuration duplication. More information can be found in the
128 128
   :func:`~django.contrib.auth.decorators.login_required` documentation.
129 129
 
  130
+* The default manage.py created by startproject will now include
  131
+  ``warnings.simplefilter("default", DeprecationWarning)``. This is to restore
  132
+  the DeprecationWarning output when running your project through manage.py.
  133
+
130 134
 Backwards incompatible changes in 1.5
131 135
 =====================================
132 136
 
4  tests/runtests.py
@@ -9,10 +9,14 @@
9 9
 from django import contrib
10 10
 from django.utils import six
11 11
 
  12
+# Python 2.7+ (and 3.2+) have silenced DeprecationWarning by default, restore the old behavior
  13
+warnings.simplefilter("default", DeprecationWarning)
  14
+
12 15
 # databrowse is deprecated, but we still want to run its tests
13 16
 warnings.filterwarnings('ignore', "The Databrowse contrib app is deprecated",
14 17
                         DeprecationWarning, 'django.contrib.databrowse')
15 18
 
  19
+
16 20
 CONTRIB_DIR_NAME = 'django.contrib'
17 21
 MODEL_TESTS_DIR_NAME = 'modeltests'
18 22
 REGRESSION_TESTS_DIR_NAME = 'regressiontests'
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.