Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

magic-removal: Fixed #1204 -- Markup filters now raise a TemplateSynt…

…axError if the Python libraries aren't installed and DEBUG=True

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2730 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 45be99d4868aec0504ecf989a97462b556ebdf86 1 parent 1e72a7f
@adrianholovaty adrianholovaty authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 django/contrib/markup/templatetags/markup.py
View
7 django/contrib/markup/templatetags/markup.py
@@ -15,6 +15,7 @@
"""
from django import template
+from django.conf import settings
register = template.Library()
@@ -22,6 +23,8 @@ def textile(value):
try:
import textile
except ImportError:
+ if settings.DEBUG:
+ raise template.TemplateSyntaxError, "Error in {% textile %} filter: The Python textile library isn't installed."
return value
else:
return textile.textile(value)
@@ -30,6 +33,8 @@ def markdown(value):
try:
import markdown
except ImportError:
+ if settings.DEBUG:
+ raise template.TemplateSyntaxError, "Error in {% markdown %} filter: The Python markdown library isn't installed."
return value
else:
return markdown.markdown(value)
@@ -38,6 +43,8 @@ def restructuredtext(value):
try:
from docutils.core import publish_parts
except ImportError:
+ if settings.DEBUG:
+ raise template.TemplateSyntaxError, "Error in {% restructuredtext %} filter: The Python docutils library isn't installed."
return value
else:
parts = publish_parts(source=value, writer_name="html4css1")
Please sign in to comment.
Something went wrong with that request. Please try again.