Ticket #2359: auto.patch

File auto.patch, 2.0 KB (added by smurf@…, 17 years ago)

don't mark unprocessed markup as safe; fix a string initializer

  • django/contrib/markup/templatetags/markup.py

    diff --git a/django/contrib/markup/templatetags/markup.py b/django/contrib/markup/templatetags/markup.py
    index a8a09ce..df8dfd1 100644
    a b def textile(value):  
    2626    except ImportError:
    2727        if settings.DEBUG:
    2828            raise template.TemplateSyntaxError, "Error in {% textile %} filter: The Python textile library isn't installed."
    29         return mark_safe(value)
     29        return value
    3030    else:
    3131        return mark_safe(textile.textile(value, encoding=settings.DEFAULT_CHARSET, output=settings.DEFAULT_CHARSET))
    3232textile.is_safe = True
    def markdown(value):  
    3737    except ImportError:
    3838        if settings.DEBUG:
    3939            raise template.TemplateSyntaxError, "Error in {% markdown %} filter: The Python markdown library isn't installed."
    40         return mark_safe(value)
     40        return value
    4141    else:
    4242        return mark_safe(markdown.markdown(value))
    4343markdown.is_safe = True
    def restructuredtext(value):  
    4848    except ImportError:
    4949        if settings.DEBUG:
    5050            raise template.TemplateSyntaxError, "Error in {% restructuredtext %} filter: The Python docutils library isn't installed."
    51         return mark_safe(value)
     51        return value
    5252    else:
    5353        docutils_settings = getattr(settings, "RESTRUCTUREDTEXT_FILTER_SETTINGS", {})
    5454        parts = publish_parts(source=value, writer_name="html4css1", settings_overrides=docutils_settings)
  • django/utils/safestring.py

    diff --git a/django/utils/safestring.py b/django/utils/safestring.py
    index eac37c6..8cac661 100644
    a b class SafeString(str, SafeData):  
    3737        if isinstance(rhs, SafeUnicode):
    3838            return SafeUnicode(self + rhs)
    3939        elif isinstance(rhs, SafeString):
    40             return SafeString(self, rhs)
     40            return SafeString(self + rhs)
    4141        else:
    4242            return super(SafeString, self).__add__(rhs)
    4343
Back to Top