Permalink
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...
1 parent 1e72a7f commit 45be99d4868aec0504ecf989a97462b556ebdf86 @adrianholovaty adrianholovaty committed Apr 23, 2006
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,13 +15,16 @@
"""
from django import template
+from django.conf import settings
register = template.Library()
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")

0 comments on commit 45be99d

Please sign in to comment.