summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-05-25 09:30:43 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-05-25 09:30:43 +0000
commit29d2094b29ccbc09f49772ca7dd773aca5114a9b (patch)
tree5532623b5c2ebfde47dd272c8c49736cddb3aec3
parentc98f0b14c42b3d49772f3ddf3c5974da79d8ad0e (diff)
downloaddjango-29d2094b29ccbc09f49772ca7dd773aca5114a9b.tar.gz
unicode: Changed the markup filters to use force_unicode() instead of
smart_unicode(), merely for consistency with the recommendations in the documentation. git-svn-id: http://code.djangoproject.com/svn/django/branches/unicode@5341 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/contrib/markup/templatetags/markup.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/django/contrib/markup/templatetags/markup.py b/django/contrib/markup/templatetags/markup.py
index 910301a106..5d1f0ff1fb 100644
--- a/django/contrib/markup/templatetags/markup.py
+++ b/django/contrib/markup/templatetags/markup.py
@@ -16,7 +16,7 @@ silently fail and return the un-marked-up text.
from django import template
from django.conf import settings
-from django.utils.encoding import smart_str, smart_unicode
+from django.utils.encoding import smart_str, force_unicode
register = template.Library()
@@ -26,9 +26,9 @@ def textile(value):
except ImportError:
if settings.DEBUG:
raise template.TemplateSyntaxError, "Error in {% textile %} filter: The Python textile library isn't installed."
- return smart_unicode(value)
+ return force_unicode(value)
else:
- return smart_unicode(textile.textile(smart_str(value), encoding='utf-8', output='utf-8'))
+ return force_unicode(textile.textile(smart_str(value), encoding='utf-8', output='utf-8'))
def markdown(value):
try:
@@ -36,9 +36,9 @@ def markdown(value):
except ImportError:
if settings.DEBUG:
raise template.TemplateSyntaxError, "Error in {% markdown %} filter: The Python markdown library isn't installed."
- return smart_unicode(value)
+ return force_unicode(value)
else:
- return smart_unicode(markdown.markdown(smart_str(value)))
+ return force_unicode(markdown.markdown(smart_str(value)))
def restructuredtext(value):
try:
@@ -46,11 +46,11 @@ def restructuredtext(value):
except ImportError:
if settings.DEBUG:
raise template.TemplateSyntaxError, "Error in {% restructuredtext %} filter: The Python docutils library isn't installed."
- return smart_unicode(value)
+ return force_unicode(value)
else:
docutils_settings = getattr(settings, "RESTRUCTUREDTEXT_FILTER_SETTINGS", {})
parts = publish_parts(source=smart_str(value), writer_name="html4css1", settings_overrides=docutils_settings)
- return smart_unicode(parts["fragment"])
+ return force_unicode(parts["fragment"])
register.filter(textile)
register.filter(markdown)