diff options
| author | Preston Holmes <preston@ptone.com> | 2012-06-23 17:57:20 +0300 |
|---|---|---|
| committer | Julien Phalip <jphalip@gmail.com> | 2012-09-08 12:13:46 -0400 |
| commit | 3da43c11113e0ef109ffbecae528aef853879281 (patch) | |
| tree | 6aa70976b417d5f314985e00a0bb707e9eb74891 /django | |
| parent | 617d077f1f5be6cfb67a1f4f9ab0334f3c793e4c (diff) | |
Fixed #18054 -- Deprecated contrib.markup. Thanks to simukis for the initial patch.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/markup/templatetags/markup.py | 6 | ||||
| -rw-r--r-- | django/contrib/markup/tests.py | 11 |
2 files changed, 16 insertions, 1 deletions
diff --git a/django/contrib/markup/templatetags/markup.py b/django/contrib/markup/templatetags/markup.py index 18b7475ca7..389c919c07 100644 --- a/django/contrib/markup/templatetags/markup.py +++ b/django/contrib/markup/templatetags/markup.py @@ -47,6 +47,9 @@ def markdown(value, arg=''): they will be silently ignored. """ + import warnings + warnings.warn('The markdown filter has been deprecated', + category=DeprecationWarning) try: import markdown except ImportError: @@ -72,6 +75,9 @@ def markdown(value, arg=''): @register.filter(is_safe=True) def restructuredtext(value): + import warnings + warnings.warn('The restructuredtext filter has been deprecated', + category=DeprecationWarning) try: from docutils.core import publish_parts except ImportError: diff --git a/django/contrib/markup/tests.py b/django/contrib/markup/tests.py index 7b050ace82..19a3b7e9d0 100644 --- a/django/contrib/markup/tests.py +++ b/django/contrib/markup/tests.py @@ -1,7 +1,9 @@ # Quick tests for the markup templatetags (django.contrib.markup) import re +import warnings from django.template import Template, Context +from django import test from django.utils import unittest from django.utils.html import escape @@ -21,7 +23,7 @@ try: except ImportError: docutils = None -class Templates(unittest.TestCase): +class Templates(test.TestCase): textile_content = """Paragraph 1 @@ -37,6 +39,13 @@ Paragraph 2 with a link_ .. _link: http://www.example.com/""" + def setUp(self): + self.save_warnings_state() + warnings.filterwarnings('ignore', category=DeprecationWarning, module='django.contrib.markup') + + def tearDown(self): + self.restore_warnings_state() + @unittest.skipUnless(textile, 'textile not installed') def test_textile(self): t = Template("{% load markup %}{{ textile_content|textile }}") |
