From 29d2094b29ccbc09f49772ca7dd773aca5114a9b Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Fri, 25 May 2007 09:30:43 +0000 Subject: [PATCH] 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 --- django/contrib/markup/templatetags/markup.py | 14 +++++++------- 1 file 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)