Django

Code

Changeset 5341

Show
Ignore:
Timestamp:
05/25/07 04:30:43 (1 year ago)
Author:
mtredinnick
Message:

unicode: Changed the markup filters to use force_unicode() instead of
smart_unicode(), merely for consistency with the recommendations in the
documentation.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/unicode/django/contrib/markup/templatetags/markup.py

    r5274 r5341  
    1717from django import template 
    1818from django.conf import settings 
    19 from django.utils.encoding import smart_str, smart_unicode 
     19from django.utils.encoding import smart_str, force_unicode 
    2020 
    2121register = template.Library() 
     
    2727        if settings.DEBUG: 
    2828            raise template.TemplateSyntaxError, "Error in {% textile %} filter: The Python textile library isn't installed." 
    29         return smart_unicode(value) 
     29        return force_unicode(value) 
    3030    else: 
    31         return smart_unicode(textile.textile(smart_str(value), encoding='utf-8', output='utf-8')) 
     31        return force_unicode(textile.textile(smart_str(value), encoding='utf-8', output='utf-8')) 
    3232 
    3333def markdown(value): 
     
    3737        if settings.DEBUG: 
    3838            raise template.TemplateSyntaxError, "Error in {% markdown %} filter: The Python markdown library isn't installed." 
    39         return smart_unicode(value) 
     39        return force_unicode(value) 
    4040    else: 
    41         return smart_unicode(markdown.markdown(smart_str(value))) 
     41        return force_unicode(markdown.markdown(smart_str(value))) 
    4242 
    4343def restructuredtext(value): 
     
    4747        if settings.DEBUG: 
    4848            raise template.TemplateSyntaxError, "Error in {% restructuredtext %} filter: The Python docutils library isn't installed." 
    49         return smart_unicode(value) 
     49        return force_unicode(value) 
    5050    else: 
    5151        docutils_settings = getattr(settings, "RESTRUCTUREDTEXT_FILTER_SETTINGS", {}) 
    5252        parts = publish_parts(source=smart_str(value), writer_name="html4css1", settings_overrides=docutils_settings) 
    53         return smart_unicode(parts["fragment"]) 
     53        return force_unicode(parts["fragment"]) 
    5454 
    5555register.filter(textile)